diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-07-28 19:24:22 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-07-28 19:24:22 -0300 |
commit | 47a5abd3ce92592c87f86d0cf33f57fff687c246 (patch) | |
tree | 93b9d4375556a36bc9ad63001f6455c280b21768 /keyword.h | |
parent | 2ddb5741c9d6c8a0942e0a73f66d21617cf378e8 (diff) |
keyword: Make `keyword_cb`, and `set_keyword()` return an `int`
`set_keyword()` now checks the return value of the callback to determine
whether to return early, fallback to the default, or return an error
if the callback returns true, false, and -1 respectivly.
Diffstat (limited to 'keyword.h')
-rw-r--r-- | keyword.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -6,7 +6,7 @@ typedef enum keyword_type keyword_type; typedef struct keyword keyword; typedef union keyword_val keyword_val; -typedef void (keyword_cb)(void *ctx, void *ret, const keyword *key, keyword_val val); +typedef int (keyword_cb)(void *ctx, void *ret, const keyword *key, keyword_val val); enum keyword_type { TYPE_NONE, @@ -35,7 +35,7 @@ union keyword_val { }; extern keyword_val get_keyword_value(const keyword *key, char *value, int *error); -extern void set_keyword(const keyword *key, keyword_val val, void *ret, void *ctx); +extern int set_keyword(const keyword *key, keyword_val val, void *ret, void *ctx); extern keyword_val parse_keyword(const keyword *key, char *key_str, char *value, int *error); extern int parse_keywords(const keyword **keys, char *key, char *value, void *ret, void *ctx); #endif |