libsystemd: drop "const" decorators on public inline functions
The point of the "const" attribute is to give the compiler hints about
behaviour of functions if it only has the function prototype but no body
around. But inline functions are the ones where the compiler *always*
has the body around, hence the "const" decorator is really just noise:
the compuler can determine the constness on its own, just by looking at
the code.
Hence, drop the decorators, it's just noise. And a source of errors, as
675fa49f69 has shown.
Follow-up for: #39289
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
e5dc514277
commit
86d9498c8c
@@ -52,10 +52,6 @@ typedef void (*_sd_destroy_t)(void *userdata);
|
||||
# define _sd_pure_ __attribute__((__pure__))
|
||||
#endif
|
||||
|
||||
#ifndef _sd_const_
|
||||
# define _sd_const_ __attribute__((__const__))
|
||||
#endif
|
||||
|
||||
/* Note that strictly speaking __deprecated__ has been available before GCC 6. However, starting with GCC 6
|
||||
* it also works on enum values, which we are interested in. Since this is a developer-facing feature anyway
|
||||
* (as opposed to build engineer-facing), let's hence conditionalize this to gcc 6, given that the developers
|
||||
|
||||
@@ -115,17 +115,17 @@ int sd_id128_get_invocation_app_specific(sd_id128_t app_id, sd_id128_t *ret);
|
||||
#define SD_ID128_MAKE_UUID_STR(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
|
||||
#a #b #c #d "-" #e #f "-" #g #h "-" #i #j "-" #k #l #m #n #o #p
|
||||
|
||||
_sd_const_ static __inline__ int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
|
||||
static __inline__ int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
|
||||
return a.qwords[0] == b.qwords[0] && a.qwords[1] == b.qwords[1];
|
||||
}
|
||||
|
||||
int sd_id128_string_equal(const char *s, sd_id128_t id);
|
||||
|
||||
_sd_const_ static __inline__ int sd_id128_is_null(sd_id128_t a) {
|
||||
static __inline__ int sd_id128_is_null(sd_id128_t a) {
|
||||
return a.qwords[0] == 0 && a.qwords[1] == 0;
|
||||
}
|
||||
|
||||
_sd_const_ static __inline__ int sd_id128_is_allf(sd_id128_t a) {
|
||||
static __inline__ int sd_id128_is_allf(sd_id128_t a) {
|
||||
return a.qwords[0] == UINT64_C(0xFFFFFFFFFFFFFFFF) && a.qwords[1] == UINT64_C(0xFFFFFFFFFFFFFFFF);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ static __inline__ int sd_id128_in_setv(sd_id128_t a, va_list ap) {
|
||||
}
|
||||
}
|
||||
|
||||
_sd_const_ static __inline__ int sd_id128_in_set_sentinel(sd_id128_t a, ...) {
|
||||
static __inline__ int sd_id128_in_set_sentinel(sd_id128_t a, ...) {
|
||||
va_list ap;
|
||||
int r;
|
||||
|
||||
|
||||
@@ -338,7 +338,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);
|
||||
|
||||
_sd_const_ static __inline__ int sd_json_format_enabled(sd_json_format_flags_t flags) {
|
||||
static __inline__ int sd_json_format_enabled(sd_json_format_flags_t flags) {
|
||||
return !(flags & SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user