Changeset ce68f23 for dict.c


Ignore:
Timestamp:
Jun 25, 2011, 3:26:16 AM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
c266281
Parents:
3cdd6d2
git-author:
David Benjamin <davidben@mit.edu> (06/11/11 20:06:46)
git-committer:
David Benjamin <davidben@mit.edu> (06/25/11 03:26:16)
Message:
Make owl_dict_get_keys return a GPtrArray

Almost all the remaining uses of owl_list are tightly coupled into this
one giant blob.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dict.c

    r6829afc rce68f23  
    5656}
    5757
    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) {
     58/* Returns a GPtrArray of dictionary keys. Duplicates the keys, so
     59 * they will need to be freed by the caller with g_free. */
     60CALLER_OWN GPtrArray *owl_dict_get_keys(const owl_dict *d) {
     61  GPtrArray *keys = g_ptr_array_sized_new(d->size);
    6162  int i;
    62   for (i=0; i<d->size; i++) {
    63     owl_list_append_element(l, g_strdup(d->els[i].k));
     63  for (i = 0; i < d->size; i++) {
     64    g_ptr_array_add(keys, g_strdup(d->els[i].k));
    6465  }
     66  return keys;
    6567}
    6668
Note: See TracChangeset for help on using the changeset viewer.