Changeset 839697d for message.c


Ignore:
Timestamp:
May 7, 2010, 9:40:35 PM (11 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
4727d31
Parents:
a41c8d1
git-author:
Nelson Elhage <nelhage@mit.edu> (05/07/10 20:31:20)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/07/10 21:40:35)
Message:
Make owl_message_get_cc_without_recipient return a GList.

Signed-off-by: Nelson Elhage <nelhage@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    r9a7b4f2 r839697d  
    584584
    585585/* caller must free return value */
    586 char *owl_message_get_cc_without_recipient(const owl_message *m)
    587 {
    588   char *cc, *out, *end, *shortuser, *recip;
     586GList *owl_message_get_cc_without_recipient(const owl_message *m)
     587{
     588  char *cc, *shortuser, *recip;
    589589  const char *user;
     590  GList *out = NULL;
    590591
    591592  cc = owl_message_get_cc(m);
     
    594595
    595596  recip = short_zuser(owl_message_get_recipient(m));
    596   out = owl_malloc(strlen(cc) + 2);
    597   end = out;
    598597
    599598  user = strtok(cc, " ");
     
    601600    shortuser = short_zuser(user);
    602601    if (strcasecmp(shortuser, recip) != 0) {
    603       strcpy(end, user);
    604       end[strlen(user)] = ' ';
    605       end += strlen(user) + 1;
     602      out = g_list_prepend(out, owl_strdup(user));
    606603    }
    607604    owl_free(shortuser);
    608605    user = strtok(NULL, " ");
    609606  }
    610   end[0] = '\0';
    611607
    612608  owl_free(recip);
    613609  owl_free(cc);
    614 
    615   if (strlen(out) == 0) {
    616     owl_free(out);
    617     out = NULL;
    618   }
    619610
    620611  return(out);
Note: See TracChangeset for help on using the changeset viewer.