diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 10:30:17 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 10:30:17 -0800 |
| commit | eece8c85564b9c5ae0cb3edfe7edb684242e9227 (patch) | |
| tree | a3de972d08072bd4e7d5b626693ae174542cc58e /match.c | |
| parent | 7f0c3804dce7591332bbf6bd0922597ea675df44 (diff) | |
More static analyzer cleanup, including switching to use bools where
appropriate and EXIT_SUCESS/EXIT_FAILURE
Diffstat (limited to 'match.c')
| -rw-r--r-- | match.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -33,17 +33,18 @@ static match_t *unused_matches = NULL; static match_t *in_use_matches = NULL; #endif +__attribute__((returns_nonnull)) static match_t *new_match(void); __attribute__((nonnull, pure)) static inline const char *next_char(file_t *f, const char *str); __attribute__((nonnull)) -static const char *match_backref(const char *str, match_t *cap, unsigned int ignorecase); +static const char *match_backref(const char *str, match_t *cap, bool ignorecase); __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); +static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, bool ignorecase); // // Return the location of the next character or UTF8 codepoint. @@ -69,7 +70,7 @@ static inline const char *next_char(file_t *f, const char *str) // Attempt to match text against a previously captured value. // Return the character position after the backref has matched, or NULL if no match has occurred. // -static const char *match_backref(const char *str, match_t *cap, unsigned int ignorecase) +static const char *match_backref(const char *str, match_t *cap, bool ignorecase) { if (cap->pat->type == BP_REPLACE) { const char *text = cap->pat->args.replace.text; @@ -126,7 +127,7 @@ static const char *match_backref(const char *str, match_t *cap, unsigned int ign // // Find the next match after prev (or the first match if prev is NULL) // -match_t *next_match(def_t *defs, file_t *f, match_t *prev, pat_t *pat, unsigned int ignorecase) +match_t *next_match(def_t *defs, file_t *f, match_t *prev, pat_t *pat, bool ignorecase) { const char *str; if (prev) { @@ -147,7 +148,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. // -static 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, bool ignorecase) { switch (pat->type) { case BP_LEFTRECURSION: { |
