if (vals) {
if (hfinfo->display & BASE_EXT_STRING) {
value_string_ext *vse_p = (value_string_ext *)hfinfo->strings;
+ if (!value_string_ext_validate(vse_p)) {
+ g_warning("Invalid value_string_ext ptr for: %s", hfinfo->abbrev);
+ continue;
+ }
match_strval_ext(0, vse_p); /* "prime" the extended value_string */
printf("E\t%s\t%d\t%s\t%s\n",
hfinfo->abbrev,
return vse->_vs_match(val, vse);
}
-/* (For use by proto_registrar_dump_values() [See proto.c]) */
+/* (Fcns for use by proto_registrar_dump_values() [See proto.c]) */
+gboolean
+value_string_ext_validate(value_string_ext *vse) {
+ if (vse == NULL)
+ return FALSE;
+ if ((vse->_vs_match == (_value_string_match_t) _match_strval_ext_init) ||
+ (vse->_vs_match == _match_strval_linear) ||
+ (vse->_vs_match == _match_strval_bsearch) ||
+ (vse->_vs_match == _match_strval_index))
+ return TRUE;
+ return FALSE;
+}
+
gchar *
value_string_ext_match_type_str(value_string_ext *vse) {
if (vse->_vs_match == _match_strval_linear)
return "[Binary Search]";
if (vse->_vs_match == _match_strval_index)
return "[Direct (indexed) Access]";
- return "[Match Type not initialized]";
+ return "[Match Type not initialized or invalid]";
}
/* ----------- */
#define VALUE_STRING_EXT_VS_P(x) (x)->_vs_p
#define VALUE_STRING_EXT_VS_NUM_ENTRIES(x) (x)->_vs_num_entries
#define VALUE_STRING_EXT_VS_NAME(x) (x)->_vs_name
+
+/* (Fcns for use by proto_registrar_dump_values() [See proto.c]) */
+gboolean value_string_ext_validate(value_string_ext *vse);
gchar *value_string_ext_match_type_str(value_string_ext *vse);
/* --- --- */