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

Re: (Fwd) segfault with pcre_study alone



> At this point, pcre_error has been declared a char * but not assigned
> to by anything. You need:  
>    zwarnnam(nam, "no pattern has been compiled for study", NULL, 0);
> 
> It might also be nice to put the same if statement in pcre_match:
> "error in fullinfo" is not the most helpful error message.

I think this improves those two.

Index: Src/Modules/pcre.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.c,v
retrieving revision 1.6
diff -u -r1.6 pcre.c
--- Src/Modules/pcre.c	16 Mar 2004 15:14:39 -0000	1.6
+++ Src/Modules/pcre.c	16 Mar 2004 19:39:07 -0000
@@ -74,8 +74,8 @@
 
     if (pcre_pattern == NULL)
     {
-	zwarnnam(nam, "no pattern has been compiled for study: %s",
-		 pcre_error, 0);
+	zwarnnam(nam, "no pattern has been compiled for study",
+		 NULL, 0);
 	return 1;
     }
     
@@ -112,9 +112,9 @@
 	}
     }
     
-    if (pcre_fullinfo(pcre_pattern, pcre_hints, PCRE_INFO_CAPTURECOUNT, &capcount))
+    if (ret = pcre_fullinfo(pcre_pattern, pcre_hints, PCRE_INFO_CAPTURECOUNT, &capcount))
     {
-	zwarnnam(nam, "error in fullinfo", NULL, 0);
+	zwarnnam(nam, "error %d in fullinfo", NULL, ret);
 	return 1;
     }
     



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