Changes in dict.c [4c7c21f:f271129]
Legend:
- Unmodified
- Added
- Removed
-
dict.c
r4c7c21f rf271129 6 6 */ 7 7 8 #include <stdlib.h>9 #include <string.h>10 #include <unistd.h>11 8 #include "owl.h" 12 13 9 14 10 #define INITSIZE 30 … … 56 52 } 57 53 58 /* Appends dictionary keys to a list. Duplicates the keys, 59 * so they will need to be freed by the caller. */ 60 void owl_dict_get_keys(const owl_dict *d, owl_list *l) { 54 /* Returns a GPtrArray of dictionary keys. Duplicates the keys, so 55 * they will need to be freed by the caller with g_free. */ 56 CALLER_OWN GPtrArray *owl_dict_get_keys(const owl_dict *d) { 57 GPtrArray *keys = g_ptr_array_sized_new(d->size); 61 58 int i; 62 for (i =0; i<d->size; i++) {63 owl_list_append_element(l, g_strdup(d->els[i].k));59 for (i = 0; i < d->size; i++) { 60 g_ptr_array_add(keys, g_strdup(d->els[i].k)); 64 61 } 62 return keys; 65 63 } 66 64 … … 107 105 /* Doesn't free the value of the element, but does 108 106 * return it so the caller can free it. */ 109 void *owl_dict_remove_element(owl_dict *d, const char *k) { 107 CALLER_OWN void *owl_dict_remove_element(owl_dict *d, const char *k) 108 { 110 109 int i; 111 110 int pos, found;
Note: See TracChangeset
for help on using the changeset viewer.