aboutsummaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-18 09:15:25 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-18 09:15:25 -0800
commit3ededef53d0704f8b89c55f60bef52a64b86d62c (patch)
tree686fc67dcc174e4ae729408577c93a25fab2592b /match.c
parent65141b240218df4c40196db63429b90b1cb698a9 (diff)
Static analysis part 1
Diffstat (limited to 'match.c')
-rw-r--r--match.c7
1 files changed, 5 insertions, 2 deletions
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;