diff options
Diffstat (limited to 'src/rewrites')
| -rw-r--r-- | src/rewrites/rewrites.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/rewrites/rewrites.c b/src/rewrites/rewrites.c index a8c53ce..0968779 100644 --- a/src/rewrites/rewrites.c +++ b/src/rewrites/rewrites.c @@ -62,12 +62,11 @@ int check_pattern(str text, str pattern, str tokens[9]){ } str fill_blueprint(str bp, str tokens[9]){ - str r = {0}; int rlen = 0; for(int i = 0; i < bp.len; i++, rlen++){ if(bp.ptr[i] == '$') rlen += tokens[bp.ptr[++i]-'1'].len-1; } - r.ptr = calloc(rlen+1, sizeof(char)); + str r = dnstr(rlen); if(r.ptr == NULL){ return r; } |
