- Timestamp:
- May 12, 2011, 4:39:26 PM (14 years ago)
- Children:
- c72f884
- Parents:
- 55b2de8
- git-author:
- David Benjamin <davidben@mit.edu> (05/07/11 15:17:37)
- git-committer:
- David Benjamin <davidben@mit.edu> (05/12/11 16:39:26)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dict.c
rf25df21 r7fd0bf7 62 62 int owl_dict_get_keys(const owl_dict *d, owl_list *l) { 63 63 int i; 64 char *dupk;65 64 for (i=0; i<d->size; i++) { 66 if ((dupk = g_strdup(d->els[i].k)) == NULL) return(-1); 67 owl_list_append_element(l, dupk); 65 owl_list_append_element(l, g_strdup(d->els[i].k)); 68 66 } 69 67 return(0); … … 84 82 { 85 83 int pos, found; 86 char *dupk;87 84 found = _owl_dict_find_pos(d, k, &pos); 88 85 if (found && delete_on_replace) { … … 99 96 if (d->els==NULL) return(-1); 100 97 } 101 if ((dupk = g_strdup(k)) == NULL) return(-1);102 98 if (pos!=d->size) { 103 99 /* shift forward to leave us a slot */ … … 106 102 } 107 103 d->size++; 108 d->els[pos].k = dupk;104 d->els[pos].k = g_strdup(k); 109 105 d->els[pos].v = v; 110 106 return(0);
Note: See TracChangeset
for help on using the changeset viewer.