plumber: set match variables past the first non-matching subexpression

Fixes #563.
This commit is contained in:
Igor Burago 2022-07-27 15:51:02 +08:00 committed by Dan Cross
parent 28e91cd879
commit 4f801be055

View file

@ -45,12 +45,12 @@ setvar(Resub rs[10], char *match[10])
for(i=0; i<10; i++){ for(i=0; i<10; i++){
free(match[i]); free(match[i]);
match[i] = nil; match[i] = nil;
} if(rs[i].s.sp != nil){
for(i=0; i<10 && rs[i].s.sp!=nil; i++){ n = rs[i].e.ep-rs[i].s.sp;
n = rs[i].e.ep-rs[i].s.sp; match[i] = emalloc(n+1);
match[i] = emalloc(n+1); memmove(match[i], rs[i].s.sp, n);
memmove(match[i], rs[i].s.sp, n); match[i][n] = '\0';
match[i][n] = '\0'; }
} }
} }