Changeset c314f39


Ignore:
Timestamp:
May 16, 2010, 1:15:25 AM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
20aced3
Parents:
3f6555d
git-author:
David Benjamin <davidben@mit.edu> (05/15/10 17:47:54)
git-committer:
David Benjamin <davidben@mit.edu> (05/16/10 01:15:25)
Message:
We intern strings, so use this to punt the strcmp

Signed-off-by: David Benjamin <davidben@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    r3f6555d rc314f39  
    6161  owl_pair *p = NULL, *pair = NULL;
    6262
     63  attrname = g_intern_string(attrname);
     64
    6365  /* look for an existing pair with this key, */
    6466  j=owl_list_get_size(&(m->attributes));
    6567  for (i=0; i<j; i++) {
    6668    p=owl_list_get_element(&(m->attributes), i);
    67     if (!strcmp(owl_pair_get_key(p), attrname)) {
     69    if (owl_pair_get_key(p) == attrname) {
    6870      owl_free(owl_pair_get_value(p));
    6971      pair = p;
     
    7476  if(pair ==  NULL) {
    7577    pair = owl_malloc(sizeof(owl_pair));
    76     owl_pair_create(pair, g_intern_string(attrname), NULL);
     78    owl_pair_create(pair, attrname, NULL);
    7779    owl_list_append_element(&(m->attributes), pair);
    7880  }
     
    8789  int i, j;
    8890  owl_pair *p;
     91  GQuark quark;
     92
     93  quark = g_quark_try_string(attrname);
     94  if (quark == 0)
     95    /* don't bother inserting into string table */
     96    return NULL;
     97  attrname = g_quark_to_string(quark);
    8998
    9099  j=owl_list_get_size(&(m->attributes));
    91100  for (i=0; i<j; i++) {
    92101    p=owl_list_get_element(&(m->attributes), i);
    93     if (!strcmp(owl_pair_get_key(p), attrname)) {
     102    if (owl_pair_get_key(p) == attrname) {
    94103      return(owl_pair_get_value(p));
    95104    }
Note: See TracChangeset for help on using the changeset viewer.