about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/compresult.c20
-rw-r--r--Src/string.c20
3 files changed, 18 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index b815fa6fa..a89ee127d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-09-27  Clint Adams  <schizo@debian.org>
+
+	* 12863: Src/string.c, Src/Zle/compresult.c: remove ztrdupstring(),
+	fold guts back into ztat(), change memory allocation to VARARR.
+
 2000-09-25  Bart Schaefer  <schaefer@zsh.org>
 
 	* 12862: Src/exec.c: Fix STTY parameter to match documentation.
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 92bb2c803..544d4a8a8 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -732,16 +732,22 @@ mod_export int
 ztat(char *nam, struct stat *buf, int ls)
 {
     int e;
-    char *b;
 
     if (!(ls ? lstat(nam, buf) : stat(nam, buf)))
 	return 0;
-
-    b = ztrdupstrip(nam, '\\');
-
-    e = ls ? lstat(b, buf) : stat(b, buf);
-    zsfree(b);
-    return e;
+    else {
+	char *p;
+	VARARR(char, b, strlen(nam) + 1);
+
+	for (p = b; *nam; nam++)
+	    if (*nam == '\\' && nam[1])
+		*p++ = *++nam;
+	    else
+		*p++ = *nam;
+	*p = '\0';
+	
+	return ls ? lstat(b, buf) : stat(b, buf);
+    }
 }
 
 /* Insert a single match in the command line. */
diff --git a/Src/string.c b/Src/string.c
index 57775359e..3dad89911 100644
--- a/Src/string.c
+++ b/Src/string.c
@@ -133,23 +133,3 @@ appstr(char *base, char const *append)
 {
     return strcat(realloc(base, strlen(base) + strlen(append) + 1), append);
 }
-
-/* Duplicate a string, stripping delimiters. */
-
-/**/
-mod_export char *
-ztrdupstrip(const char *nam, char delim)
-{
-    char *p, *buf;
-
-    buf = zalloc(strlen(nam));
-
-    for (p = buf; *nam; nam++)
-        if (*nam == delim && nam[1])
-            *p++ = *++nam;
-        else
-            *p++ = *nam;
-    *p = '\0';
-
-    return buf;
-}