diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-09-23 14:38:46 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-09-23 14:38:46 -0700 |
| commit | 89c5888dd66c09cb304d21e2ce6f96c9cc42461f (patch) | |
| tree | c66fc21d73e481f9890f62669b6e573cc267af1c /pattern.h | |
| parent | 86404d0ab3651ad5347aeada02566bd5b8eaa0af (diff) | |
Switched to using an optional type
Diffstat (limited to 'pattern.h')
| -rw-r--r-- | pattern.h | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -7,18 +7,29 @@ #include "files.h" #include "types.h" +typedef struct { + bool success; + union { + pat_t *pat; + struct { + const char *start, *end, *msg; + } error; + } value; +} maybe_pat_t; + __attribute__((returns_nonnull, nonnull(1,2))) pat_t *new_pat(file_t *f, const char *start, const char *end, size_t minlen, ssize_t maxlen, enum pattype_e type); __attribute__((nonnull)) -pat_t *bp_stringpattern(file_t *f, const char *str); +maybe_pat_t bp_stringpattern(file_t *f, const char *str); __attribute__((nonnull(1,2))) -pat_t *bp_replacement(file_t *f, pat_t *replacepat, const char *replacement); +maybe_pat_t bp_replacement(file_t *f, pat_t *replacepat, const char *replacement); __attribute__((nonnull(1))) pat_t *chain_together(file_t *f, pat_t *first, pat_t *second); __attribute__((nonnull(1))) pat_t *either_pat(file_t *f, pat_t *first, pat_t *second); __attribute__((nonnull)) -pat_t *bp_pattern(file_t *f, const char *str); +maybe_pat_t bp_pattern(file_t *f, const char *str); + #endif // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 |
