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 <ps@pks.im>
Tested-by: Chuck Tuffli <chuck@freebsd.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Patrick Steinhardt 2020-09-07 17:27:32 +02:00 committed by Daniel Kiper
parent 74259522d7
commit b35792dccb

View file

@ -36,13 +36,14 @@ enum grub_json_type
}; };
typedef enum grub_json_type grub_json_type_t; 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 struct grub_json
{ {
jsmntok_t *tokens; struct jsmntok *tokens;
char *string; char *string;
grub_size_t idx; grub_size_t idx;
}; };
typedef struct grub_json grub_json_t; typedef struct grub_json grub_json_t;