various part 2



patch 4: balsa/src/message-window.c

see yourself. it checks for some stuff and returns
false, then checks for one stuff and returns true
and definately returns false if not found. so i
changed this to check only for TRUE and if its not
found return FALSE.

info 1: src/quote-color.c

near end we get this function.

is_a_quote(const gchar * str, regex_t * rex)
{
    gint cnt = 0, off;
    regmatch_t rm[1];

    g_return_val_if_fail(rex != NULL, 0);

    if (str == NULL)                               <----
	return 0;                                  <---- return 0

    off = 0;
    while (regexec(rex, str + off, 1, rm, 0) == 0) {
	off += rm[0].rm_eo;
	cnt++;                                     <----
    }

    return cnt;                                    <---- what happens
                                                         if cnt returns 0 ?
}

shouldnt things like *str be double checked to avoid
problems, since str must not be null all the time
so

if (str == NULL || *str == '\0')
    return 0;

would be more save.... questions ? ideas ? any corrections ?
comments ?

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
--- balsa-cvs/src/message-window.c	Wed Oct 17 13:57:43 2001
+++ balsa/src/message-window.c	Wed Oct 17 15:34:24 2001
@@ -826,22 +826,17 @@
 find_url_cb(GNode *gnode, struct BalsaMRUEntry *data)
 {
     BalsaMailboxNode *node;
-    
+
     node=gnode->data;
-    if(!node || !BALSA_IS_MAILBOX_NODE(node))
-	return(FALSE);
-    
-    if(!node->mailbox)
-	return(FALSE);
-    
+
     if(!strcmp(LIBBALSA_MAILBOX(node->mailbox)->url, data->url)) {
 	data->url=LIBBALSA_MAILBOX(node->mailbox)->url;
 	data->name=LIBBALSA_MAILBOX(node->mailbox)->name;
 	data->mailbox=LIBBALSA_MAILBOX(node->mailbox);
 	return TRUE;
+    } else {
+	return FALSE;
     }
-	
-    return FALSE;
 }
 
 static void


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