From: Patrick Steinhardt Date: Mon, 7 Sep 2020 15:27:32 +0000 (+0200) Subject: json: Remove invalid typedef redefinition X-Git-Tag: grub-2.06-rc1~216 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b35792dccb44aff310b0461ba89abdf01d28a3f0;p=thirdparty%2Fgrub.git json: Remove invalid typedef redefinition The C standard does not allow for typedef redefinitions, even if they map to the same underlying type. In order to avoid including the jsmn.h in json.h and thus exposing jsmn's internals, we have exactly such a forward-declaring typedef in json.h. If enforcing the GNU99 C standard, clang may generate a warning about this non-standard construct. Fix the issue by using a simple "struct jsmntok" forward declaration instead of using a typedef. Signed-off-by: Patrick Steinhardt Tested-by: Chuck Tuffli Reviewed-by: Daniel Kiper --- diff --git a/grub-core/lib/json/json.h b/grub-core/lib/json/json.h index 01614f6df..4ea2a22d8 100644 --- a/grub-core/lib/json/json.h +++ b/grub-core/lib/json/json.h @@ -36,13 +36,14 @@ enum grub_json_type }; typedef enum grub_json_type grub_json_type_t; -typedef struct jsmntok jsmntok_t; +/* Forward-declaration to avoid including jsmn.h. */ +struct jsmntok; struct grub_json { - jsmntok_t *tokens; - char *string; - grub_size_t idx; + struct jsmntok *tokens; + char *string; + grub_size_t idx; }; typedef struct grub_json grub_json_t;