[112641] trunk/base/src/darwintracelib1.0/darwintrace.c

cal at macports.org cal at macports.org
Mon Oct 28 11:57:30 PDT 2013


Revision: 112641
          https://trac.macports.org/changeset/112641
Author:   cal at macports.org
Date:     2013-10-28 11:57:30 -0700 (Mon, 28 Oct 2013)
Log Message:
-----------
darwintrace: avoid some calls to stdlib string functions to avoid call overhead

Modified Paths:
--------------
    trunk/base/src/darwintracelib1.0/darwintrace.c

Modified: trunk/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- trunk/base/src/darwintracelib1.0/darwintrace.c	2013-10-28 18:29:43 UTC (rev 112640)
+++ trunk/base/src/darwintracelib1.0/darwintrace.c	2013-10-28 18:57:30 UTC (rev 112641)
@@ -851,10 +851,10 @@
 		} else if (*curpos == '\0') {
 			/* empty entry, ignore */
 			continue;
-		} else if (strcmp(curpos, ".") == 0) {
+		} else if (curpos[0] == '.' && curpos[1] == '\0') {
 			/* no-op directory, ignore */
 			continue;
-		} else if (strcmp(curpos, "..") == 0) {
+		} else if (curpos[0] == '.' && curpos[1] == '.' && curpos[2] == '\0') {
 			/* walk up one directory */
 			char *lastSep = strrchr(normalizedpath, '/');
 			if (lastSep == NULL) {
@@ -869,12 +869,12 @@
 			continue;
 		}
 		/* default case: standard path, copy */
-		strcat(normpos, "/");
-		normpos++;
-		strcat(normpos, curpos);
+		*normpos++ = '/';
+		strcpy(normpos, curpos);
 	}
 	if (*normalizedpath == '\0') {
-		strcat(normalizedpath, "/");
+		*normalizedpath++ = '/';
+		*normalizedpath++ = '\0';
 	}
 
 	/* Iterate over the sandbox bounds and try to find a directive matching this path */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131028/f9ac5c76/attachment.html>


More information about the macports-changes mailing list