diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2022-10-11 11:52:17 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2022-10-11 11:52:17 +0100 |
commit | a3a646da9561494361aef54e710d7cabec8106f2 (patch) | |
tree | 4b6c6fbe57949f76d8af833194009ecb8b845064 | |
parent | f6a1279a8e00fa52bb82733cccc633bc09ef83c0 (diff) | |
download | json-glib-a3a646da9561494361aef54e710d7cabec8106f2.tar.gz |
Initialise all missing struct fields
Avoid compiler warnings.
-rw-r--r-- | json-glib/json-scanner.c | 75 | ||||
-rw-r--r-- | json-glib/tests/path.c | 15 |
2 files changed, 52 insertions, 38 deletions
diff --git a/json-glib/json-scanner.c b/json-glib/json-scanner.c index e9a58be..73a510e 100644 --- a/json-glib/json-scanner.c +++ b/json-glib/json-scanner.c @@ -85,41 +85,42 @@ struct _JsonScannerConfig static JsonScannerConfig json_scanner_config_template = { - ( " \t\r\n" ) /* cset_skip_characters */, - ( - "_" - G_CSET_a_2_z - G_CSET_A_2_Z - ) /* cset_identifier_first */, - ( - G_CSET_DIGITS - "-_" - G_CSET_a_2_z - G_CSET_A_2_Z - ) /* cset_identifier_nth */, - ( "//\n" ) /* cpair_comment_single */, - TRUE /* case_sensitive */, - TRUE /* skip_comment_multi */, - TRUE /* skip_comment_single */, - FALSE /* scan_comment_multi */, - TRUE /* scan_identifier */, - TRUE /* scan_identifier_1char */, - FALSE /* scan_identifier_NULL */, - TRUE /* scan_symbols */, - TRUE /* scan_binary */, - TRUE /* scan_octal */, - TRUE /* scan_float */, - TRUE /* scan_hex */, - TRUE /* scan_hex_dollar */, - TRUE /* scan_string_sq */, - TRUE /* scan_string_dq */, - TRUE /* numbers_2_int */, - FALSE /* int_2_float */, - FALSE /* identifier_2_string */, - TRUE /* char_2_token */, - TRUE /* symbol_2_token */, - FALSE /* scope_0_fallback */, - TRUE /* store_int64 */ + .cset_skip_characters = ( " \t\r\n" ), + .cset_identifier_first = ( + "_" + G_CSET_a_2_z + G_CSET_A_2_Z + ), + .cset_identifier_nth = ( + G_CSET_DIGITS + "-_" + G_CSET_a_2_z + G_CSET_A_2_Z + ), + .cpair_comment_single = ( "//\n" ), + .case_sensitive = TRUE, + .skip_comment_multi = TRUE, + .skip_comment_single = TRUE, + .scan_comment_multi = FALSE, + .scan_identifier = TRUE, + .scan_identifier_1char = TRUE, + .scan_identifier_NULL = FALSE, + .scan_symbols = TRUE, + .scan_binary = TRUE, + .scan_octal = TRUE, + .scan_float = TRUE, + .scan_hex = TRUE, + .scan_hex_dollar = TRUE, + .scan_string_sq = TRUE, + .scan_string_dq = TRUE, + .numbers_2_int = TRUE, + .int_2_float = FALSE, + .identifier_2_string = FALSE, + .char_2_token = TRUE, + .symbol_2_token = TRUE, + .scope_0_fallback = FALSE, + .store_int64 = TRUE, + .padding_dummy = 0, }; /* --- defines --- */ @@ -282,8 +283,8 @@ json_scanner_free_value (GTokenType *token_p, static void json_scanner_destroy_symbol_table_entry (gpointer _key, - gpointer _value, - gpointer _data) + gpointer _value G_GNUC_UNUSED, + gpointer _data G_GNUC_UNUSED) { JsonScannerKey *key = _key; diff --git a/json-glib/tests/path.c b/json-glib/tests/path.c index 2781ead..864e84a 100644 --- a/json-glib/tests/path.c +++ b/json-glib/tests/path.c @@ -98,72 +98,84 @@ static const struct { "$.store.book[0].title", "[\"Sayings of the Century\"]", TRUE, + 0, }, { "Title of the first book in the store, using array notation.", "$['store']['book'][0]['title']", "[\"Sayings of the Century\"]", TRUE, + 0, }, { "All the authors from the every book.", "$.store.book[*].author", "[\"Nigel Rees\",\"Evelyn Waugh\",\"Herman Melville\",\"J. R. R. Tolkien\"]", TRUE, + 0, }, { "All the authors.", "$..author", "[\"Nigel Rees\",\"Evelyn Waugh\",\"Herman Melville\",\"J. R. R. Tolkien\"]", TRUE, + 0, }, { "Everything inside the store.", "$.store.*", NULL, TRUE, + 0, }, { "All the prices in the store.", "$.store..price", "[\"8.95\",\"12.99\",\"8.99\",\"22.99\",\"19.95\"]", TRUE, + 0, }, { "The third book.", "$..book[2]", "[{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":\"8.99\"}]", TRUE, + 0, }, { "The last book.", "$..book[-1:]", "[{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":\"22.99\"}]", TRUE, + 0, }, { "The first two books.", "$..book[0,1]", "[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":\"8.95\"},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":\"12.99\"}]", TRUE, + 0, }, { "The first two books, using a slice.", "$..book[:2]", "[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":\"8.95\"},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":\"12.99\"}]", TRUE, + 0, }, { "All the books.", "$['store']['book'][*]", "[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":\"8.95\"},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":\"12.99\"},{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":\"8.99\"},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":\"22.99\"}]", TRUE, + 0, }, { "All the members of the bicycle object.", "$.store.bicycle.*", "[\"red\",\"19.95\"]", TRUE, + 0, }, { "The root node.", @@ -174,7 +186,8 @@ static const struct { "{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":\"22.99\"}]," "\"bicycle\":{\"color\":\"red\",\"price\":\"19.95\"}}}]", TRUE, - } + 0, + }, }; static void |