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

PATCH: pws-19: parameters again



Playing around with modules again, I noticed that the setpm*s functions
aren't protected against a call with a null hash table, which happens when
they are unset.

--- Src/Modules/parameter.c.us	Thu May 20 09:28:28 1999
+++ Src/Modules/parameter.c	Sat May 22 15:18:07 1999
@@ -207,6 +207,9 @@
     int i;
     HashNode hn;
 
+    if (!ht)
+	return;
+
     for (i = 0; i < ht->hsize; i++)
 	for (hn = ht->nodes[i]; hn; hn = hn->next) {
 	    Cmdnam cn = zcalloc(sizeof(*cn));
@@ -375,6 +378,9 @@
     int i;
     HashNode hn;
 
+    if (!ht)
+	return;
+
     for (i = 0; i < ht->hsize; i++)
 	for (hn = ht->nodes[i]; hn; hn = hn->next) {
 	    struct value v;
@@ -504,6 +510,9 @@
 {
     int i;
     HashNode hn;
+
+    if (!ht)
+	return;
 
     for (i = 0; i < ht->hsize; i++)
 	for (hn = ht->nodes[i]; hn; hn = hn->next) {

-- 
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