bug-texinfo
[Top][All Lists]
Advanced

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

[patch] 4.7: Clean up path scanning termination


From: Maciej W. Rozycki
Subject: [patch] 4.7: Clean up path scanning termination
Date: Fri, 30 Jul 2004 15:16:02 +0200 (CEST)

Hello,

 The code to finish path scanning upon the end of the string in
extract_colon_unit() is unnecessarily complicated -- I think it's a 
historical leftover.  I propose to clean it up a bit as follows.

2004-07-30  Maciej W. Rozycki  <address@hidden>

        * info/filesys.c (extract_colon_unit): Clean up handling of the 
        end of string.

 The patch was created for 4.5, but it applies to 4.7, too.  It works fine 
for me and I think it is obviously correct.  Please apply.

  Maciej

texinfo-4.5-info-path.patch
diff -up --recursive --new-file texinfo-4.5.macro/info/filesys.c 
texinfo-4.5/info/filesys.c
--- texinfo-4.5.macro/info/filesys.c    2003-01-31 19:18:11.000000000 +0000
+++ texinfo-4.5/info/filesys.c  2003-04-04 18:56:03.000000000 +0000
@@ -283,13 +283,13 @@ extract_colon_unit (string, idx)
   if (!string || i >= strlen (string))
     return NULL;
 
+  if (!string[i]) /* end of string */
+    return NULL;
+
   /* Advance to next PATH_SEP.  */
   while (string[i] && string[i] != PATH_SEP[0])
     i++;
 
-  if (!string[i] && i == start) /* end of string, and didn't advance */
-    return NULL;
-
   {
     char *value = xmalloc ((i - start) + 1);
     strncpy (value, &string[start], (i - start));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]