Changeset fda61d3 for dict.c


Ignore:
Timestamp:
May 20, 2011, 3:59:31 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
351c535
Parents:
3b8a563
git-author:
David Benjamin <davidben@mit.edu> (05/07/11 15:17:37)
git-committer:
David Benjamin <davidben@mit.edu> (05/20/11 15:59:31)
Message:
g_strdup and g_new0 never fail

Remove pointless failure checks cluttering the code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dict.c

    rf25df21 rfda61d3  
    6262int owl_dict_get_keys(const owl_dict *d, owl_list *l) {
    6363  int i;
    64   char *dupk;
    6564  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));
    6866  }
    6967  return(0);
     
    8482{
    8583  int pos, found;
    86   char *dupk;
    8784  found = _owl_dict_find_pos(d, k, &pos);
    8885  if (found && delete_on_replace) {
     
    9996      if (d->els==NULL) return(-1);
    10097    }
    101     if ((dupk = g_strdup(k)) == NULL) return(-1);
    10298    if (pos!=d->size) {
    10399      /* shift forward to leave us a slot */
     
    106102    }
    107103    d->size++;
    108     d->els[pos].k = dupk;
     104    d->els[pos].k = g_strdup(k);
    109105    d->els[pos].v = v;   
    110106    return(0);
Note: See TracChangeset for help on using the changeset viewer.