Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dict.c

    rf25df21 r4c7c21f  
    1515#define GROWBY 3 / 2
    1616
    17 int owl_dict_create(owl_dict *d) {
     17void owl_dict_create(owl_dict *d) {
    1818  d->size=0;
    1919  d->els=g_new(owl_dict_el, INITSIZE);
    2020  d->avail=INITSIZE;
    21   if (d->els==NULL) return(-1);
    22   return(0);
    2321}
    2422
     
    6058/* Appends dictionary keys to a list.  Duplicates the keys,
    6159 * so they will need to be freed by the caller. */
    62 int owl_dict_get_keys(const owl_dict *d, owl_list *l) {
     60void owl_dict_get_keys(const owl_dict *d, owl_list *l) {
    6361  int i;
    64   char *dupk;
    6562  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);
     63    owl_list_append_element(l, g_strdup(d->els[i].k));
    6864  }
    69   return(0);
    7065}
    7166
     
    8479{
    8580  int pos, found;
    86   char *dupk;
    8781  found = _owl_dict_find_pos(d, k, &pos);
    8882  if (found && delete_on_replace) {
     
    9993      if (d->els==NULL) return(-1);
    10094    }
    101     if ((dupk = g_strdup(k)) == NULL) return(-1);
    10295    if (pos!=d->size) {
    10396      /* shift forward to leave us a slot */
     
    10699    }
    107100    d->size++;
    108     d->els[pos].k = dupk;
     101    d->els[pos].k = g_strdup(k);
    109102    d->els[pos].v = v;   
    110103    return(0);
Note: See TracChangeset for help on using the changeset viewer.