diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-07-02 14:49:22 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-07-02 14:49:22 +0200 |
commit | 62511367857a6f34f6b2f81dc094f9d632ad01bd (patch) | |
tree | 3a9093afa52a7c1c435f308c1eeaa1a1631b5bf4 /src | |
parent | b1da28134a8d922e483d6591b9a87a68a479c177 (diff) | |
download | OFQT-62511367857a6f34f6b2f81dc094f9d632ad01bd.tar.gz OFQT-62511367857a6f34f6b2f81dc094f9d632ad01bd.zip |
add support for conditional vdf values, return NULL on invalid state
Diffstat (limited to 'src')
-rw-r--r-- | src/vdf/vdf.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vdf/vdf.c b/src/vdf/vdf.c index c9130a6..5b2f274 100644 --- a/src/vdf/vdf.c +++ b/src/vdf/vdf.c @@ -13,6 +13,8 @@ #define CHAR_DOUBLE_QUOTE '"' #define CHAR_OPEN_CURLY_BRACKET '{' #define CHAR_CLOSED_CURLY_BRACKET '}' +#define CHAR_OPEN_ANGLED_BRACKET '[' +#define CHAR_CLOSED_ANGLED_BRACKET ']' #define CHAR_FRONTSLASH '/' #define CHAR_BACKSLASH '\\' @@ -231,7 +233,23 @@ struct vdf_object* vdf_parse_buffer(const char* buffer, size_t size) break; + case CHAR_OPEN_ANGLED_BRACKET: + printf("%i\n", buf); + if (!buf) + while (*tail != '\0' && *tail != CHAR_CLOSED_ANGLED_BRACKET) + ++tail; + break; + default: + if (!buf) + { + // we found something we are probably not suppose to + // the easiest way out is to just terminate + vdf_free_object(root_object); + return NULL; + } + break; + case CHAR_NEWLINE: case CHAR_SPACE: case CHAR_TAB: |