[64155] trunk/base/src/pextlib1.0/tracelib.c

raimue at macports.org raimue at macports.org
Tue Feb 23 16:31:07 PST 2010


Revision: 64155
          http://trac.macports.org/changeset/64155
Author:   raimue at macports.org
Date:     2010-02-23 16:31:04 -0800 (Tue, 23 Feb 2010)
Log Message:
-----------
pextlib1.0/tracelib.c: Prefer '\0' for the string termination. Add some comments.

Modified Paths:
--------------
    trunk/base/src/pextlib1.0/tracelib.c

Modified: trunk/base/src/pextlib1.0/tracelib.c
===================================================================
--- trunk/base/src/pextlib1.0/tracelib.c	2010-02-24 00:08:50 UTC (rev 64154)
+++ trunk/base/src/pextlib1.0/tracelib.c	2010-02-24 00:31:04 UTC (rev 64155)
@@ -158,7 +158,9 @@
 		return 0;
 	if(!len)
 		return 0;
-	buf[len]=0;
+	
+	buf[len] = '\0';
+	
 	for(t=buf;*t&&t-buf<(int)sizeof(buf);t=next_t)
 	{
 		next_t = t+strlen(t)+1;
@@ -176,7 +178,7 @@
 						ui_warn("recv failed");
 						return 0;
 					}
-					if(*end_of_t++ == 0)
+					if(*end_of_t++ == '\0')
 						break;
 				}
 			}
@@ -188,8 +190,12 @@
 			ui_warn("malformed command %s", t);
 			break;
 		}
-		*f++=0;
 
+		/* Replace \t with \0 */
+		*f = '\0';
+		/* Advance pointer to arguments */
+		f++;
+
 		if(!strcmp(t, "filemap"))
 		{
 			send_file_map(sock);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100223/473ef863/attachment.html>


More information about the macports-changes mailing list