Changeset d199207


Ignore:
Timestamp:
Mar 11, 2012, 10:58:01 PM (9 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.9
Children:
3e34a69, 5111af4, d6b8b50
Parents:
a03a409
git-author:
Anders Kaseorg <andersk@mit.edu> (01/19/12 21:32:33)
git-committer:
David Benjamin <davidben@mit.edu> (03/11/12 22:58:01)
Message:
zephyr: Use field iterator interface to avoid quadratic loops

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

Legend:

Unmodified
Added
Removed
  • functions.c

    r97cdbaf5 rd199207  
    14311431      char *tmpbuff, *tmpbuff2;
    14321432      int i, fields;
     1433      const char *f;
    14331434
    14341435      if (!owl_message_is_pseudo(m)) {
     
    14721473        owl_fmtext_appendf_normal(&fm, "  Fields    : %i\n", fields);
    14731474
    1474         for (i = 0; i < fields; i++) {
    1475           tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1);
     1475        for (i = 0, f = owl_zephyr_first_raw_field(n); f != NULL;
     1476             i++, f = owl_zephyr_next_raw_field(n, f)) {
     1477          tmpbuff = owl_zephyr_field_as_utf8(n, f);
    14761478          tmpbuff2 = owl_text_indent(tmpbuff, 14, false);
    14771479          owl_fmtext_appendf_normal(&fm, "  Field %i   : %s\n", i + 1, tmpbuff2);
  • perlconfig.c

    r7803326 rd199207  
    7575  const char *type;
    7676  char *ptr, *utype, *blessas;
    77   int i, j;
     77  const char *f;
     78  int i;
    7879  const owl_pair *pair;
    7980  const owl_filter *wrap;
     
    9697
    9798    av_zfields = newAV();
    98     j=owl_zephyr_get_num_fields(owl_message_get_notice(m));
    99     for (i=0; i<j; i++) {
    100       ptr=owl_zephyr_get_field_as_utf8(owl_message_get_notice(m), i+1);
     99    for (f = owl_zephyr_first_raw_field(owl_message_get_notice(m)); f != NULL;
     100         f = owl_zephyr_next_raw_field(owl_message_get_notice(m), f)) {
     101      ptr=owl_zephyr_field_as_utf8(owl_message_get_notice(m), f);
    101102      av_push(av_zfields, owl_new_sv(ptr));
    102103      g_free(ptr);
Note: See TracChangeset for help on using the changeset viewer.