sd-json: don't use C99 bool in public headers

All our public headers strive to C90 compatibility with a few
extensions, and thus avoided stdbool.h and bool.

The sd_json_format_enabled() helper seems like a poor place to start
requiring stdbool.h now.

Also drop __extension__ since we are not using it anywhere else in very
similar inline functions.

(And we probably should drop any _sd_const declarations on inline
functions. Given that the compiler has the function implementation
around always, because it's in the header there's really no reason to
specify this manually, the compiler can trivially figure this out on its
own. But that's for another time.)
This commit is contained in:
Lennart Poettering
2024-10-31 07:59:41 +09:00
committed by Yu Watanabe
parent cb15aa7b37
commit 2ff3adeb29
2 changed files with 1 additions and 3 deletions
+1 -2
View File
@@ -20,7 +20,6 @@
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
@@ -343,7 +342,7 @@ int sd_json_variant_unhex(sd_json_variant *v, void **ret, size_t *ret_size);
const char* sd_json_variant_type_to_string(sd_json_variant_type_t t);
sd_json_variant_type_t sd_json_variant_type_from_string(const char *s);
__extension__ _sd_const_ static __inline__ bool sd_json_format_enabled(sd_json_format_flags_t flags) {
_sd_const_ static __inline__ int sd_json_format_enabled(sd_json_format_flags_t flags) {
return !(flags & SD_JSON_FORMAT_OFF);
}
-1
View File
@@ -18,7 +18,6 @@
***/
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include "sd-json.h"