Changeset ce68f23 for perlconfig.c


Ignore:
Timestamp:
Jun 25, 2011, 3:26:16 AM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, 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
  • perlconfig.c

    rf9df2f0 rce68f23  
    3636}
    3737
    38 CALLER_OWN AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
     38CALLER_OWN AV *owl_new_av(const GPtrArray *l, SV *(*to_sv)(const void *))
    3939{
    4040  AV *ret;
     
    4444  ret = newAV();
    4545
    46   for (i = 0; i < owl_list_get_size(l); i++) {
    47     element = owl_list_get_element(l, i);
     46  for (i = 0; i < l->len; i++) {
     47    element = l->pdata[i];
    4848    av_push(ret, to_sv(element));
    4949  }
     
    5555{
    5656  HV *ret;
    57   owl_list l;
     57  GPtrArray *keys;
    5858  const char *key;
    5959  void *element;
     
    6363
    6464  /* TODO: add an iterator-like interface to owl_dict */
    65   owl_list_create(&l);
    66   owl_dict_get_keys(d, &l);
    67   for (i = 0; i < owl_list_get_size(&l); i++) {
    68     key = owl_list_get_element(&l, i);
     65  keys = owl_dict_get_keys(d);
     66  for (i = 0; i < keys->len; i++) {
     67    key = keys->pdata[i];
    6968    element = owl_dict_find_element(d, key);
    7069    (void)hv_store(ret, key, strlen(key), to_sv(element), 0);
    7170  }
    72   owl_list_cleanup(&l, g_free);
     71  owl_ptr_array_free(keys, g_free);
    7372
    7473  return ret;
Note: See TracChangeset for help on using the changeset viewer.