Mercurial > hg > freeDiameter
changeset 770:27fef2ca2cf6
Improved usability of fd_dict_getlistof for vendors and apps
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Sun, 30 Oct 2011 12:33:28 +0100 |
parents | 99136ec7d9d4 |
children | eac79a449c06 |
files | libfdproto/dictionary.c tests/testdict.c |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libfdproto/dictionary.c Tue Oct 25 21:48:52 2011 +0200 +++ b/libfdproto/dictionary.c Sun Oct 30 12:33:28 2011 +0100 @@ -1968,7 +1968,7 @@ #define NO_VENDOR_NAME "(no vendor)" new->dict_vendors.data.vendor.vendor_name = NO_VENDOR_NAME; new->dict_vendors.datastr_len = CONSTSTRLEN(NO_VENDOR_NAME); - new->dict_vendors.list[0].o = NULL; /* overwrite since element is also sentinel for this list. */ + /* new->dict_vendors.list[0].o = NULL; *//* overwrite since element is also sentinel for this list. */ new->dict_vendors.dico = new; /* Initialize the sentinel for applications */ @@ -1976,7 +1976,7 @@ #define APPLICATION_0_NAME "Diameter Common Messages" new->dict_applications.data.application.application_name = APPLICATION_0_NAME; new->dict_applications.datastr_len = CONSTSTRLEN(APPLICATION_0_NAME); - new->dict_applications.list[0].o = NULL; /* overwrite since since element is also sentinel for this list. */ + /* new->dict_applications.list[0].o = NULL; *//* overwrite since since element is also sentinel for this list. */ new->dict_applications.dico = new; /* Initialize the sentinel for types */
--- a/tests/testdict.c Tue Oct 25 21:48:52 2011 +0200 +++ b/tests/testdict.c Sun Oct 30 12:33:28 2011 +0100 @@ -136,12 +136,19 @@ enum dict_object_type type; struct dict_object * defvnd=NULL; vendor_id_t vid = 0; + int first = 1; CHECK( 0, fd_dict_getlistof(VENDOR_BY_ID, fd_g_config->cnf_dict, &sentinel)); - for (li = sentinel->next; li != sentinel; li = li->next) { + for (li = sentinel; (li != sentinel) || (first != 0); li = li->next) { + first = 0; CHECK(0, fd_dict_gettype(li->o, &type)); CHECK(DICT_VENDOR, type); +#if 0 + struct dict_vendor_data data; + CHECK( 0, fd_dict_getval(li->o, &data) ); + printf("%d : %s\n", data.vendor_id, data.vendor_name); +#endif } CHECK( 0, fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_ID, &vid, &defvnd, ENOENT) );