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

Re: Cores almost on demand in patcompile()



On Thu, 20 Oct 2016 11:56:34 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> It's a long time since I did this but if the P_PURESTR flag is set,
> I don't think there can be more than one P_EXACTLY.  So the solution may
> be to break out of the for loop at the end of the
> 
> 		    if (P_OP(pscan) == P_EXACTLY) {
> 		        /* .... */
> 			break;      /* <- here... */
> 		    }

This time with a patch (hope everyone's enjoying the white knuckle ride)

pws

diff --git a/Src/pattern.c b/Src/pattern.c
index 158bfd5..ba7c155 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -690,6 +690,8 @@ patcompile(char *exp, int inflags, char **endexp)
 				*dst++ = *opnd++;
 			    }
 			}
+			/* Only one string in a PAT_PURES, so now done. */
+			break;
 		    }
 		}
 		p->size = dst - patout;



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