From 3ededef53d0704f8b89c55f60bef52a64b86d62c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 18 Jan 2021 09:15:25 -0800 Subject: Static analysis part 1 --- match.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'match.c') diff --git a/match.c b/match.c index 128e9da..63f44c6 100644 --- a/match.c +++ b/match.c @@ -33,6 +33,7 @@ static match_t *unused_matches = NULL; static match_t *in_use_matches = NULL; #endif +static match_t *new_match(void); __attribute__((nonnull, pure)) static inline const char *next_char(file_t *f, const char *str); __attribute__((nonnull)) @@ -41,6 +42,8 @@ __attribute__((nonnull)) static match_t *get_capture_by_num(match_t *m, int *n); __attribute__((nonnull, pure)) static match_t *get_capture_by_name(match_t *m, const char *name); +__attribute__((hot, nonnull(2,3,4))) +static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, unsigned int flags); // // Return the location of the next character or UTF8 codepoint. @@ -144,7 +147,7 @@ match_t *next_match(def_t *defs, file_t *f, match_t *prev, pat_t *pat, unsigned // match object, or NULL if no match is found. // The returned value should be free()'d to avoid memory leaking. // -match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, unsigned int ignorecase) +static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, unsigned int ignorecase) { switch (pat->type) { case BP_LEFTRECURSION: { @@ -574,7 +577,7 @@ match_t *get_capture(match_t *m, const char **id) // // Return a match object which can be used (may be allocated or recycled). // -match_t *new_match(void) +static match_t *new_match(void) { match_t *m; -- cgit v1.2.3