diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-12 22:33:28 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-12 22:33:28 -0800 |
| commit | 6deb08a4ab64a998a5844df8f61fb8abe56f5d7b (patch) | |
| tree | a868d425cacc7f5b4c5775aa26a76fe26c2e3696 /vm.c | |
| parent | 2d109f974b6a03a79db3dd8a5ffe5c2aff76659e (diff) | |
Added forward declarations for static functions
Diffstat (limited to 'vm.c')
| -rw-r--r-- | vm.c | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -12,11 +12,28 @@ #include "utils.h" #include "vm.h" +typedef struct recursive_ref_s { + const vm_op_t *op; + const char *pos; + struct recursive_ref_s *prev; + int hit; + match_t *result; +} recursive_ref_t; + +__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, vm_op_t *op, match_t *cap, unsigned int flags); +__attribute__((hot, nonnull(2,3,4))) +static match_t *_match(def_t *defs, file_t *f, const char *str, vm_op_t *op, unsigned int flags, recursive_ref_t *rec); +__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); // // UTF8-compliant char iteration // -__attribute__((nonnull, pure)) static inline const char *next_char(file_t *f, const char *str) { char c = *str; @@ -44,19 +61,10 @@ void destroy_match(match_t **m) *m = NULL; } -typedef struct recursive_ref_s { - const vm_op_t *op; - const char *pos; - struct recursive_ref_s *prev; - int hit; - match_t *result; -} recursive_ref_t; - // // 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. // -__attribute__((nonnull)) static const char *match_backref(const char *str, vm_op_t *op, match_t *cap, unsigned int flags) { check(op->type == VM_BACKREF, "Attempt to match backref against something that's not a backref"); @@ -117,7 +125,6 @@ static const char *match_backref(const char *str, vm_op_t *op, match_t *cap, uns // a match struct, or NULL if no match is found. // The returned value should be free()'d to avoid memory leaking. // -__attribute__((hot, nonnull(2,3,4))) static match_t *_match(def_t *defs, file_t *f, const char *str, vm_op_t *op, unsigned int flags, recursive_ref_t *rec) { switch (op->type) { @@ -477,7 +484,6 @@ static match_t *_match(def_t *defs, file_t *f, const char *str, vm_op_t *op, uns // // Get a specific numbered pattern capture. // -__attribute__((nonnull)) static match_t *get_capture_by_num(match_t *m, int *n) { if (*n == 0) return m; @@ -493,7 +499,6 @@ static match_t *get_capture_by_num(match_t *m, int *n) // // Get a capture with a specific name. // -__attribute__((nonnull, pure)) static match_t *get_capture_by_name(match_t *m, const char *name) { if (m->op->type == VM_CAPTURE && m->op->args.capture.name |
