Re: [evolution-patches] Fix for bug 72145 (groupwise provider)




It is rather redundant that you're using g_strdup() on a value you then free ...  but you shouldn't even be doing it anyway.

Problems:

You should use a GString if you're going to build strings.  Using g_strcat() is very very inefficient for many reasons.  Not to mention that you are leaking the previous string every time through the loop.  It is more efficient also if you allocate a single GString outside of the outside loop of this function, and just do g_string_truncate(s, 0) before the recp_list loop.

Since you are using the default camel-folder-summary 'messageinfo' virtual methods (and you should continue to do this), you MUST allocate the strings the way they are expected.  Use camel_pstring_strdup(), these strings are uniquified and ref-counted, it saves significant memory (not to mention, it will crash reliably if you don't).  This goes for all of the strings in the base MessageInfo structure, except "uid" which must be a normal g_malloc'd string.


On Thu, 2005-03-03 at 17:14 +0530, Parthasarathi Susarla wrote:
+                               for (rl = recp_list; rl != NULL; rl = rl->next) {
+                                       EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
+                                       if (recp->type == E_GW_ITEM_RECIPIENT_TO) {
+                                               if (i)
+                                                       str = g_strconcat (str, ", ", NULL);
+                                               str = g_strconcat (str, recp->display_name,"<",
+                                                                  recp->email,">", NULL);
+                                       }
+                                       i++;
+                               }
+                               mi->info.to = g_strdup(str);
+                               g_free (str);
                        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]