Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    rd427f08 rf9df2f0  
    4343
    4444  owl_message_set_hostname(m, "");
    45   owl_list_create(&(m->attributes));
     45  m->attributes = g_ptr_array_new();
    4646 
    4747  /* save the time */
     
    5858void owl_message_set_attribute(owl_message *m, const char *attrname, const char *attrvalue)
    5959{
    60   int i, j;
     60  int i;
    6161  owl_pair *p = NULL, *pair = NULL;
    6262
     
    6464
    6565  /* look for an existing pair with this key, */
    66   j=owl_list_get_size(&(m->attributes));
    67   for (i=0; i<j; i++) {
    68     p=owl_list_get_element(&(m->attributes), i);
     66  for (i = 0; i < m->attributes->len; i++) {
     67    p = m->attributes->pdata[i];
    6968    if (owl_pair_get_key(p) == attrname) {
    7069      g_free(owl_pair_get_value(p));
     
    7776    pair = g_new(owl_pair, 1);
    7877    owl_pair_create(pair, attrname, NULL);
    79     owl_list_append_element(&(m->attributes), pair);
     78    g_ptr_array_add(m->attributes, pair);
    8079  }
    8180  owl_pair_set_value(pair, owl_validate_or_convert(attrvalue));
     
    8786const char *owl_message_get_attribute_value(const owl_message *m, const char *attrname)
    8887{
    89   int i, j;
     88  int i;
    9089  owl_pair *p;
    9190  GQuark quark;
     
    9796  attrname = g_quark_to_string(quark);
    9897
    99   j=owl_list_get_size(&(m->attributes));
    100   for (i=0; i<j; i++) {
    101     p=owl_list_get_element(&(m->attributes), i);
     98  for (i = 0; i < m->attributes->len; i++) {
     99    p = m->attributes->pdata[i];
    102100    if (owl_pair_get_key(p) == attrname) {
    103101      return(owl_pair_get_value(p));
     
    118116 */
    119117void owl_message_attributes_tofmtext(const owl_message *m, owl_fmtext *fm) {
    120   int i, j;
     118  int i;
    121119  owl_pair *p;
    122120  char *buff, *tmpbuff;
     
    124122  owl_fmtext_init_null(fm);
    125123
    126   j=owl_list_get_size(&(m->attributes));
    127   for (i=0; i<j; i++) {
    128     p=owl_list_get_element(&(m->attributes), i);
     124  for (i = 0; i < m->attributes->len; i++) {
     125    p = m->attributes->pdata[i];
    129126
    130127    tmpbuff = g_strdup(owl_pair_get_value(p));
     
    580577
    581578/* caller must free return value. */
    582 G_GNUC_WARN_UNUSED_RESULT char *owl_message_get_cc(const owl_message *m)
     579CALLER_OWN char *owl_message_get_cc(const owl_message *m)
    583580{
    584581  const char *cur;
     
    597594
    598595/* caller must free return value */
    599 G_GNUC_WARN_UNUSED_RESULT GList *owl_message_get_cc_without_recipient(const owl_message *m)
     596CALLER_OWN GList *owl_message_get_cc_without_recipient(const owl_message *m)
    600597{
    601598  char *cc, *shortuser, *recip;
     
    10041001void owl_message_cleanup(owl_message *m)
    10051002{
    1006   int i, j;
     1003  int i;
    10071004  owl_pair *p;
    10081005#ifdef HAVE_LIBZEPHYR   
     
    10141011
    10151012  /* free all the attributes */
    1016   j=owl_list_get_size(&(m->attributes));
    1017   for (i=0; i<j; i++) {
    1018     p=owl_list_get_element(&(m->attributes), i);
     1013  for (i = 0; i < m->attributes->len; i++) {
     1014    p = m->attributes->pdata[i];
    10191015    g_free(owl_pair_get_value(p));
    10201016    g_free(p);
    10211017  }
    10221018
    1023   owl_list_cleanup(&(m->attributes), NULL);
     1019  g_ptr_array_free(m->attributes, true);
    10241020 
    10251021  owl_message_invalidate_format(m);
Note: See TracChangeset for help on using the changeset viewer.