Mercurial > hg > freeDiameter
comparison extensions/dbg_dict_dump_json/dbg_dict_dump_json.cc @ 1457:da5e5b9c9623
dbg_dict_dump_json: fix ERROR warnings in log
fd_dict_search(TYPE_OF_AVP) matches NULL when the AVP is not derived,
so don't call fd_dict_getval() in that case.
Fixes the ERROR logs from dbg_dict_dump_json.
author | Luke Mewburn <luke@mewburn.net> |
---|---|
date | Fri, 28 Feb 2020 11:05:24 +1100 |
parents | 8627338e36ab |
children |
comparison
equal
deleted
inserted
replaced
1456:8627338e36ab | 1457:da5e5b9c9623 |
---|---|
30 **********************************************************************************************************/ | 30 **********************************************************************************************************/ |
31 | 31 |
32 | 32 |
33 /* | 33 /* |
34 * Dump Diameter dictionary to JSON file. | 34 * Dump Diameter dictionary to JSON file. |
35 * | |
36 * TODO: find out reason for many warnings in log | |
37 */ | 35 */ |
38 | 36 |
39 #include <freeDiameter/extension.h> | 37 #include <freeDiameter/extension.h> |
40 #include "dictionary-internal.h" | 38 #include "dictionary-internal.h" |
41 #include <json/json.h> | 39 #include <json/json.h> |
159 struct dict_object *type = NULL; | 157 struct dict_object *type = NULL; |
160 struct dict_type_data type_data; | 158 struct dict_type_data type_data; |
161 Json::Value avp; | 159 Json::Value avp; |
162 char flags[10]; | 160 char flags[10]; |
163 | 161 |
164 fd_dict_search(fd_g_config->cnf_dict, DICT_TYPE, TYPE_OF_AVP, self, &type, ENOENT); | 162 if (fd_dict_search(fd_g_config->cnf_dict, DICT_TYPE, TYPE_OF_AVP, self, &type, 0) != 0) { |
165 if (fd_dict_getval(type, &type_data) != 0) { | 163 /* TODO: fd_dict_search error */ |
164 return; | |
165 } | |
166 | |
167 if ((type == NULL) || (fd_dict_getval(type, &type_data) != 0)) { | |
166 avp["Type"] = Json::Value(type_base_name[data->avp_basetype]); | 168 avp["Type"] = Json::Value(type_base_name[data->avp_basetype]); |
167 } else { | 169 } else { |
168 if (strstr(type_data.type_name, "Enumerated") != 0) { | 170 if (strstr(type_data.type_name, "Enumerated") != 0) { |
169 if (data->avp_basetype == AVP_TYPE_INTEGER32) { | 171 if (data->avp_basetype == AVP_TYPE_INTEGER32) { |
170 avp["Type"] = "Enumerated"; | 172 avp["Type"] = "Enumerated"; |