summaryrefslogtreecommitdiff
path: root/Src/pattern.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-08-22 01:55:58 +0200
committerAxel Beckert <abe@deuxchevaux.org>2015-08-22 01:55:58 +0200
commit02f6e25bfcd5feb9a093377dda0dd549cdf5c309 (patch)
tree9a25e61122b3fa0d0a1ff68b5ef05c775ff78b1e /Src/pattern.c
parente04a19735ffc8523b93b33074f685ad4e2c92e0c (diff)
parent881474edcb223ac22a08d81a824809c33ca3a9c9 (diff)
downloadzsh-02f6e25bfcd5feb9a093377dda0dd549cdf5c309.tar.gz
zsh-02f6e25bfcd5feb9a093377dda0dd549cdf5c309.zip
Merge tag 'zsh-5.0.8-test-2' into debian
Diffstat (limited to 'Src/pattern.c')
-rw-r--r--Src/pattern.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/Src/pattern.c b/Src/pattern.c
index 4e5e8a110..7d38988a0 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -520,6 +520,8 @@ patcompile(char *exp, int inflags, char **endexp)
char *lng, *strp = NULL;
Patprog p;
+ queue_signals();
+
startoff = sizeof(struct patprog);
/* Ensure alignment of start of program string */
startoff = (startoff + sizeof(union upat) - 1) & ~(sizeof(union upat) - 1);
@@ -582,8 +584,10 @@ patcompile(char *exp, int inflags, char **endexp)
if (!strp || (*strp && *strp != '/')) {
/* No, do normal compilation. */
strp = NULL;
- if (patcompswitch(0, &flags) == 0)
+ if (patcompswitch(0, &flags) == 0) {
+ unqueue_signals();
return NULL;
+ }
} else {
/*
* Yes, copy the string, and skip compilation altogether.
@@ -715,6 +719,8 @@ patcompile(char *exp, int inflags, char **endexp)
if (endexp)
*endexp = patparse;
+
+ unqueue_signals();
return p;
}
@@ -1113,8 +1119,8 @@ range_type(char *start, int len)
const char **csp;
for (csp = colon_stuffs; *csp; csp++) {
- if (!strncmp(start, *csp, len))
- return (csp - colon_stuffs) + PP_FIRST;
+ if (strlen(*csp) == len && !strncmp(start, *csp, len))
+ return (csp - colon_stuffs) + PP_FIRST;
}
return PP_UNKWN;
@@ -2202,20 +2208,15 @@ pattryrefs(Patprog prog, char *string, int stringlen, int unmetalen,
if ((patglobflags & GF_MATCHREF) &&
!(patflags & PAT_FILE)) {
char *str = ztrduppfx(patinstart, patinlen);
- char *ptr = patinstart;
- int mlen = 0;
+ int mlen;
/*
* Count the characters. We're not using CHARSUB()
- * because the string is still metafied. We're
- * not using mb_metastrlen() because that expects
- * the string to be null terminated.
+ * because the string is still metafied.
*/
MB_METACHARINIT();
- while (ptr < patinstart + patinlen) {
- mlen++;
- ptr += MB_METACHARLEN(ptr);
- }
+ mlen = MB_METASTRLEN2END(patinstart, 0,
+ patinstart + patinlen);
setsparam("MATCH", str);
setiparam("MBEGIN",