]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-json: don't use C99 bool in public headers
authorLennart Poettering <lennart@poettering.net>
Wed, 30 Oct 2024 20:55:13 +0000 (21:55 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Oct 2024 22:59:41 +0000 (07:59 +0900)
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.)

src/systemd/sd-json.h
src/systemd/sd-varlink-idl.h

index 02c5843f0792359e8a54b2d7a834dd54e88270ad..3930d82b0d02817cd5e9a1246862ac602a83050b 100644 (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);
 }
 
index e5e8a57498899c00b68f8c28a9c44cbc26ef31c3..620cbf50cb5f0aa0570990c758e067189d346722 100644 (file)
@@ -18,7 +18,6 @@
 ***/
 
 #include <errno.h>
-#include <stdbool.h>
 #include <stdio.h>
 
 #include "sd-json.h"