Re: [PATCH] : Final clean-up patch for address-entry



On 2002.02.11 08:43 Emmanuel wrote:
> 	Hi all,
> just a janitorial work on address-entry to have an almost clean 
> source + some improvment for libbalsa_strsplit (simpler, faster) and 
> libbalsa_fill_input.
> This is the last patch on address-entry, on my part.
> On current CVS
> Bye
> Manu

A few thoughts:

Why change the declaration of libbalsa_strsplit:
> -static GList *
> +GList *
>  libbalsa_strsplit(const gchar *str, gchar delimiter)

Here you could trim leading blanks, if it helps later:
> +    for (current=str;*current;current++) {
> +	if (*current == '"') quoted = !quoted;
> +	else if ( (!quoted) && (*current == delimiter) ) {
> +	    glist = g_list_append(glist, g_strndup(old,
> current-old));
             while (current[1] == ' ')
                 ++current;
+           old=current+1;
>  	}

Don't you still need a test here? What if str ended with a delimiter?
> -    if (str) {
> -	data = g_strndup(old, i - previous);
> -	glist = g_list_append(glist, data);
>      }
> +    glist = g_list_append(glist, g_strndup(old, current-old));

The first time through this loop, addy points to the current 
address--is that what you want?
      size = prev = 0;
-    for (list = g_list_first(address_entry->active);
-        list != NULL;
-        list = g_list_next(list)) {
-       if (cursor >= size) {
-           prev = size;
-           address_entry->active = list;
-       }
+    for (list = address_entry->active;list;list = g_list_next(list)) {
+       prev = size;
+       size += strlen(addy->user) + 1;
         addy = (emailData *)list->data;



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