Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: minor stuff



I noticed that dyncat() was advertised as always using heap memory, whereas
actually it uses ncalloc() which chooses the current sort of allocation.
Since all the uses seem to be in places where the memory doesn't get
explicitly freed, maybe we should change the code to match the comment
(which I probably put there).

While I was doing this I noticed that the hashtable element tablename was
never freed.  It's only used with --zsh-hash-debug.

--- Src/glob.c.dc	Mon Jun 14 09:22:10 1999
+++ Src/glob.c	Thu Jun 24 18:04:31 1999
@@ -1993,7 +1993,7 @@
     char *ptr;
     int l1 = strlen(s1);
 
-    ptr = (char *)ncalloc(l1 + strlen(s2) + 1);
+    ptr = (char *)zhalloc(l1 + strlen(s2) + 1);
     strcpy(ptr, s1);
     strcpy(ptr + l1, s2);
     return ptr;
--- Src/hashtable.c.dc	Fri Jun 18 13:49:29 1999
+++ Src/hashtable.c	Thu Jun 24 17:57:56 1999
@@ -133,6 +133,7 @@
 	ht->last->next = ht->next;
     else
 	firstht = ht->next;
+    zsfree(ht->tablename);
 #endif /* ZSH_HASH_DEBUG */
     zfree(ht->nodes, ht->hsize * sizeof(HashNode));
     zfree(ht, sizeof(*ht));

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author