Changeset 7fd0bf7
- 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)
- Files:
-
- 3 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); -
keymap.c
r47e0a6a r7fd0bf7 9 9 { 10 10 if (!name || !desc) return(-1); 11 if ((km->name = g_strdup(name)) == NULL) return(-1);12 if ((km->desc = g_strdup(desc)) == NULL) return(-1);13 if (0 != owl_list_create(&km->bindings)) return(-1);11 km->name = g_strdup(name); 12 km->desc = g_strdup(desc); 13 owl_list_create(&km->bindings); 14 14 km->parent = NULL; 15 15 km->default_fn = default_fn; -
list.c
rddbbcffa r7fd0bf7 5 5 #define GROWBY 3 / 2 6 6 7 intowl_list_create(owl_list *l)7 void owl_list_create(owl_list *l) 8 8 { 9 9 l->size=0; 10 10 l->list=g_new(void *, INITSIZE); 11 11 l->avail=INITSIZE; 12 if (l->list==NULL) return(-1);13 return(0);14 12 } 15 13
Note: See TracChangeset
for help on using the changeset viewer.