diff options
-rw-r--r-- | psi/zstring.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/psi/zstring.c b/psi/zstring.c index 33662dafa..58e1af2b3 100644 --- a/psi/zstring.c +++ b/psi/zstring.c | |||
@@ -142,13 +142,18 @@ search_impl(i_ctx_t *i_ctx_p, bool forward) | |||
142 | return 0; | 142 | return 0; |
143 | found: | 143 | found: |
144 | op->tas.type_attrs = op1->tas.type_attrs; | 144 | op->tas.type_attrs = op1->tas.type_attrs; |
145 | op->value.bytes = ptr; | 145 | op->value.bytes = ptr; /* match */ |
146 | r_set_size(op, size); | 146 | op->tas.rsize = size; /* match */ |
147 | push(2); | 147 | push(2); |
148 | op[-1] = *op1; | 148 | op[-1] = *op1; /* pre */ |
149 | r_set_size(op - 1, ptr - op[-1].value.bytes); | 149 | op[-3].value.bytes = ptr + size; /* post */ |
150 | op1->value.bytes = ptr + size; | 150 | if (forward) { |
151 | r_set_size(op1, count + (!forward ? (size - 1) : 0)); | 151 | op[-1].tas.rsize = ptr - op[-1].value.bytes; /* pre */ |
152 | op[-3].tas.rsize = count; /* post */ | ||
153 | } else { | ||
154 | op[-1].tas.rsize = count; /* pre */ | ||
155 | op[-3].tas.rsize -= count + size; /* post */ | ||
156 | } | ||
152 | make_true(op); | 157 | make_true(op); |
153 | return 0; | 158 | return 0; |
154 | } | 159 | } |