Changeset 5b54595


Ignore:
Timestamp:
Mar 11, 2012, 10:53:26 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
release-1.8
Children:
54bf650
Parents:
6a08f16
git-author:
Anders Kaseorg <andersk@mit.edu> (01/19/12 21:32:33)
git-committer:
David Benjamin <davidben@mit.edu> (03/11/12 22:53:26)
Message:
zephyr: Use field iterator interface to avoid quadratic loops

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

[davidben@mit.edu: cherry-picked onto release-1.8
 Conflicts: functions.c ]
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r34132f7 r5b54595  
    14321432      char *tmpbuff;
    14331433      int i, fields;
     1434      const char *f;
    14341435
    14351436      n=owl_message_get_notice(m);
     
    14751476        owl_fmtext_appendf_normal(&fm, "  Fields    : %i\n", fields);
    14761477
    1477         for (i = 0; i < fields; i++) {
    1478           tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1);
     1478        for (i = 0, f = owl_zephyr_first_raw_field(n); f != NULL;
     1479             i++, f = owl_zephyr_next_raw_field(n, f)) {
     1480          tmpbuff = owl_zephyr_field_as_utf8(n, f);
    14791481
    14801482          g_strdelimit(tmpbuff, "\n", '~');
  • perlconfig.c

    rdde1b4d r5b54595  
    8080  const char *type;
    8181  char *ptr, *utype, *blessas;
    82   int i, j;
     82  const char *f;
     83  int i;
    8384  const owl_pair *pair;
    8485  const owl_filter *wrap;
     
    102103
    103104    av_zfields = newAV();
    104     j=owl_zephyr_get_num_fields(owl_message_get_notice(m));
    105     for (i=0; i<j; i++) {
    106       ptr=owl_zephyr_get_field_as_utf8(owl_message_get_notice(m), i+1);
     105    for (f = owl_zephyr_first_raw_field(owl_message_get_notice(m)); f != NULL;
     106         f = owl_zephyr_next_raw_field(owl_message_get_notice(m), f)) {
     107      ptr=owl_zephyr_field_as_utf8(owl_message_get_notice(m), f);
    107108      av_push(av_zfields, owl_new_sv(ptr));
    108109      g_free(ptr);
Note: See TracChangeset for help on using the changeset viewer.