Use G_N_ELEMENTS instead of a non-const int.
authorRoss Burton <ross@openedhand.com>
Tue, 28 Aug 2007 15:46:50 +0000 (15:46 +0000)
committerRoss Burton <rburton@src.gnome.org>
Tue, 28 Aug 2007 15:46:50 +0000 (15:46 +0000)
2007-08-28  Ross Burton  <ross@openedhand.com>

* libedata-book/e-book-backend-sexp.c:
Use G_N_ELEMENTS instead of a non-const int.

svn path=/trunk/; revision=8004

addressbook/ChangeLog
addressbook/libedata-book/e-book-backend-sexp.c

index ec2b324..aff39b9 100644 (file)
@@ -1,5 +1,10 @@
 2007-08-28  Ross Burton  <ross@openedhand.com>
 
+       * libedata-book/e-book-backend-sexp.c:
+       Use G_N_ELEMENTS instead of a non-const int.
+
+2007-08-28  Ross Burton  <ross@openedhand.com>
+
        * */*:
        Fix FSF address (Tobias Mueller, #470445)
 
index 9c28388..ed72b26 100644 (file)
@@ -274,7 +274,6 @@ static struct prop_info {
        LIST_PROP ( "address",   compare_address ),
        LIST_PROP ( "category_list",  compare_category ),
 };
-static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]);
 
 static ESExpResult *
 entry_compare(SearchContext *ctx, struct _ESExp *f,
@@ -295,7 +294,7 @@ entry_compare(SearchContext *ctx, struct _ESExp *f,
                propname = argv[0]->value.string;
 
                any_field = !strcmp(propname, "x-evolution-any-field");
-               for (i = 0; i < num_prop_infos; i ++) {
+               for (i = 0; i < G_N_ELEMENTS (prop_info_table); i ++) {
                        if (any_field
                            || !strcmp (prop_info_table[i].query_prop, propname)) {
                                info = &prop_info_table[i];
@@ -419,7 +418,7 @@ func_exists(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
 
                propname = argv[0]->value.string;
 
-               for (i = 0; i < num_prop_infos; i ++) {
+               for (i = 0; i < G_N_ELEMENTS (prop_info_table); i ++) {
                        if (!strcmp (prop_info_table[i].query_prop, propname)) {
                                info = &prop_info_table[i];