Re: [evolution-patches] [evolution-data-server] Fix for bug #331633



Hi, 

Modified as per Jeff's suggestion :) 

Please review :) 

thanks 

--Irene
On Tue, 2006-02-21 at 11:34 -0500, Jeffrey Stedfast wrote:
> On Mon, 2006-02-20 at 02:40 -0700, Veerapuram Varadhan wrote:
> > On Sat, 2006-02-18 at 04:48 +0000, Irene Huang  wrote:
> > > +       if (strlen(dn_value->str))
> > > +               dn = g_strndup (dn_value->str, strlen(dn_value->str) -
> > > 1);
> > 
> > Wouldn't it be better to store strlen() in a variable, instead of
> > calling strlen twice?
> 
> another idea is simply doing:
> 
> if (dn_value->str[0])
> 
> no need to strlen it.
> 
> > 
> > Thanks,
> > 
> > V. Varadhan
> > _______________________________________________
> > Evolution-patches mailing list
> > Evolution-patches gnome org
> > http://mail.gnome.org/mailman/listinfo/evolution-patches
> > 
Index: servers/exchange/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.65
diff -u -r1.65 ChangeLog
--- servers/exchange/ChangeLog	6 Mar 2006 06:41:32 -0000	1.65
+++ servers/exchange/ChangeLog	6 Mar 2006 08:26:50 -0000
@@ -1,3 +1,10 @@
+2006-03-06  Irene Huang <Irene Huang sun com>
+
+	Fixes bug #331633
+
+	* lib/e2k-global-catalog.c: (find_domain_dn): Check and see if 
+	dn_value->str[0] is nil before duplicating.
+
 2006-03-06  Sushma Rai  <rsushma novell com>
 
 	* storage/e-folder-exchange.c (e_folder_exchange_new_from_file): 
Index: servers/exchange/lib/e2k-global-catalog.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-global-catalog.c,v
retrieving revision 1.5
diff -u -r1.5 e2k-global-catalog.c
--- servers/exchange/lib/e2k-global-catalog.c	13 Dec 2005 03:54:28 -0000	1.5
+++ servers/exchange/lib/e2k-global-catalog.c	6 Mar 2006 08:26:51 -0000
@@ -1023,7 +1023,10 @@
 		g_string_append (dn_value, ",");
 		sub_domain = strtok (NULL, ".");
 	}
-	dn = g_strndup (dn_value->str, strlen(dn_value->str) - 1);
+	if (dn_value->str[0])
+		dn = g_strndup (dn_value->str, strlen(dn_value->str) - 1);
+	else 
+		dn = NULL;
 	g_string_free (dn_value, TRUE);
 	return dn;
 }


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