[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/9] json: Remove invalid typedef redefinition
From: |
Patrick Steinhardt |
Subject: |
[PATCH v2 1/9] json: Remove invalid typedef redefinition |
Date: |
Wed, 26 Aug 2020 10:13:24 +0200 |
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>
---
grub-core/lib/json/json.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/grub-core/lib/json/json.h b/grub-core/lib/json/json.h
index 01614f6df..657902cfc 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;
--
2.28.0
signature.asc
Description: PGP signature
- Re: [PATCH 3/9] luks2: Fix use of incorrect index and some error messages, (continued)
- [PATCH 4/9] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors, Patrick Steinhardt, 2020/08/23
- [PATCH 5/9] luks2: Improve error reporting when decrypting/verifying key, Patrick Steinhardt, 2020/08/23
- [PATCH 6/9] cryptodisk: Unregister cryptomount command when removing module, Patrick Steinhardt, 2020/08/23
- [PATCH 7/9] cryptodisk: Incorrect calculation of start sector for grub_disk_read in grub_cryptodisk_read, Patrick Steinhardt, 2020/08/23
- [PATCH 8/9] cryptodisk: Fix cipher IV mode 'plain64' always being set as 'plain', Patrick Steinhardt, 2020/08/23
- [PATCH 9/9] cryptodisk: Properly handle non-512 byte sized sectors, Patrick Steinhardt, 2020/08/23
- Re: [PATCH 0/9] Cryptodisk fixes for v2.06, Glenn Washburn, 2020/08/24
- [PATCH v2 0/9] Cryptodisk fixes for v2.06, Patrick Steinhardt, 2020/08/26
- [PATCH v2 1/9] json: Remove invalid typedef redefinition,
Patrick Steinhardt <=
- [PATCH v2 2/9] luks: Fix out-of-bounds copy of UUID, Patrick Steinhardt, 2020/08/26
- [PATCH v2 3/9] luks2: Fix use of incorrect index and some error messages, Patrick Steinhardt, 2020/08/26
- [PATCH v2 4/9] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors, Patrick Steinhardt, 2020/08/26
- [PATCH v2 5/9] luks2: Improve error reporting when decrypting/verifying key, Patrick Steinhardt, 2020/08/26
- [PATCH v2 6/9] cryptodisk: Unregister cryptomount command when removing module, Patrick Steinhardt, 2020/08/26
- [PATCH v2 7/9] cryptodisk: Fix incorrect calculation of start sector, Patrick Steinhardt, 2020/08/26
- [PATCH v2 8/9] cryptodisk: Fix cipher IV mode 'plain64' always being set as 'plain', Patrick Steinhardt, 2020/08/26