svn commit: samba r11229 - branches/SAMBA_3_0/source/lib trunk/source/lib

jmcd at samba.org jmcd at samba.org
Thu Oct 20 16:05:12 GMT 2005


Author: jmcd
Date: 2005-10-20 16:05:12 +0000 (Thu, 20 Oct 2005)
New Revision: 11229

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11229

Log:
an even bigger speedup spotted by Volker.  string_to_sid() is now taking 1/5th
the time it used to.  Replace strcasecmp with invididual char checks for 
"S-" sid prefix.

Modified:
   branches/SAMBA_3_0/source/lib/util_sid.c
   trunk/source/lib/util_sid.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_sid.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_sid.c	2005-10-20 15:09:41 UTC (rev 11228)
+++ branches/SAMBA_3_0/source/lib/util_sid.c	2005-10-20 16:05:12 UTC (rev 11229)
@@ -262,12 +262,12 @@
 	/* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */
 	uint32 conv;
   
-	if (StrnCaseCmp( sidstr, "S-", 2)) {
+	if ((sidstr[0] != 'S' && sidstr[0] != 's') || sidstr[1] != '-') {
 		DEBUG(0,("string_to_sid: Sid %s does not start with 'S-'.\n", sidstr));
 		return False;
 	}
 
-	ZERO_STRUCTP(sidout);
+//	ZERO_STRUCTP(sidout);
 
 	/* Get the revision number. */
 	p = sidstr + 2;

Modified: trunk/source/lib/util_sid.c
===================================================================
--- trunk/source/lib/util_sid.c	2005-10-20 15:09:41 UTC (rev 11228)
+++ trunk/source/lib/util_sid.c	2005-10-20 16:05:12 UTC (rev 11229)
@@ -262,12 +262,12 @@
 	/* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */
 	uint32 conv;
   
-	if (StrnCaseCmp( sidstr, "S-", 2)) {
+	if ((sidstr[0] != 'S' && sidstr[0] != 's') || sidstr[1] != '-') {
 		DEBUG(0,("string_to_sid: Sid %s does not start with 'S-'.\n", sidstr));
 		return False;
 	}
 
-	ZERO_STRUCTP(sidout);
+//	ZERO_STRUCTP(sidout);
 
 	/* Get the revision number. */
 	p = sidstr + 2;



More information about the samba-cvs mailing list