Corrige geração do código do ano.
[cascardo/declara.git] / lib / pmhash.c
index ca9cfca..2bf6c43 100644 (file)
@@ -78,7 +78,7 @@ void * pmhash_get(struct pmhash *pmhash, char *key)
        for (i = 0; i < pmhash->len; i++) {
                if (pmhash->items[i].key == NULL)
                        return NULL;
-               if (!strcmp(pmhash->items[i].key, key))
+               if (!strcasecmp(pmhash->items[i].key, key))
                        return pmhash->items[i].val;
        }
        return NULL;
@@ -95,3 +95,17 @@ void pmhash_del(struct pmhash *pmhash)
        }
        free(pmhash);
 }
+
+void * pmhash_next(struct pmhash *pmhash, void **iter)
+{
+       int i;
+       struct item *item = *iter;
+       if (item == NULL)
+               i = 0;
+       else
+               i = item - pmhash->items + 1;
+       if (i >= (int) pmhash->len)
+               return NULL;
+       *iter = pmhash->items + i;
+       return pmhash->items[i].val;
+}