diff options
| -rw-r--r-- | match.c | 21 | ||||
| -rw-r--r-- | match.h | 2 | ||||
| -rw-r--r-- | pattern.c | 21 | ||||
| -rw-r--r-- | pattern.h | 2 |
4 files changed, 23 insertions, 23 deletions
@@ -664,25 +664,4 @@ size_t free_all_matches(void) } #endif -// -// Deallocate memory referenced inside a pattern struct -// -void destroy_pat(pat_t *pat) -{ - switch (pat->type) { - case VM_STRING: case VM_REF: - xfree(&pat->args.s); - break; - case VM_CAPTURE: - if (pat->args.capture.name) - xfree(&pat->args.capture.name); - break; - case VM_REPLACE: - if (pat->args.replace.text) - xfree(&pat->args.replace.text); - break; - default: break; - } -} - // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1 @@ -14,8 +14,6 @@ __attribute__((hot, nonnull(2,3,4))) match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, unsigned int flags); __attribute__((nonnull)) match_t *get_capture(match_t *m, const char **id); -__attribute__((nonnull)) -void destroy_pat(pat_t *pat); match_t *new_match(void); __attribute__((nonnull)) void recycle_if_unused(match_t **at_m); @@ -613,4 +613,25 @@ def_t *bp_definition(file_t *f, const char *str) return def; } +// +// Deallocate memory referenced inside a pattern struct +// +void destroy_pat(pat_t *pat) +{ + switch (pat->type) { + case VM_STRING: case VM_REF: + xfree(&pat->args.s); + break; + case VM_CAPTURE: + if (pat->args.capture.name) + xfree(&pat->args.capture.name); + break; + case VM_REPLACE: + if (pat->args.replace.text) + xfree(&pat->args.replace.text); + break; + default: break; + } +} + // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1 @@ -19,6 +19,8 @@ __attribute__((nonnull)) pat_t *bp_pattern(file_t *f, const char *str); __attribute__((nonnull)) def_t *bp_definition(file_t *f, const char *str); +__attribute__((nonnull)) +void destroy_pat(pat_t *pat); #endif // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1 |
