mirror of
https://github.com/systemd/systemd
synced 2026-03-24 15:55:00 +01:00
Compare commits
No commits in common. "c7cfde640d2b32ff1eb893d1fcd291c25cd421e7" and "b10abe4bba61aebe4c667c412741193f11886298" have entirely different histories.
c7cfde640d
...
b10abe4bba
@ -214,7 +214,7 @@ static inline size_t GREEDY_ALLOC_ROUND_UP(size_t l) {
|
|||||||
* Contrary to strlen(), this is a constant expression.
|
* Contrary to strlen(), this is a constant expression.
|
||||||
* @x: a string literal.
|
* @x: a string literal.
|
||||||
*/
|
*/
|
||||||
#define STRLEN(x) (sizeof(""x"") - 1U)
|
#define STRLEN(x) ((unsigned) sizeof(""x"") - 1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* container_of - cast a member of a structure out to the containing structure
|
* container_of - cast a member of a structure out to the containing structure
|
||||||
@ -345,12 +345,12 @@ static inline int __coverity_check_and_return__(int condition) {
|
|||||||
(2U+(sizeof(type) <= 1 ? 3U : \
|
(2U+(sizeof(type) <= 1 ? 3U : \
|
||||||
sizeof(type) <= 2 ? 5U : \
|
sizeof(type) <= 2 ? 5U : \
|
||||||
sizeof(type) <= 4 ? 10U : \
|
sizeof(type) <= 4 ? 10U : \
|
||||||
sizeof(type) <= 8 ? 20U : sizeof(int[-2*(sizeof(type) > 8)])))
|
sizeof(type) <= 8 ? 20U : (unsigned) sizeof(int[-2*(sizeof(type) > 8)])))
|
||||||
|
|
||||||
#define DECIMAL_STR_WIDTH(x) \
|
#define DECIMAL_STR_WIDTH(x) \
|
||||||
({ \
|
({ \
|
||||||
typeof(x) _x_ = (x); \
|
typeof(x) _x_ = (x); \
|
||||||
size_t ans = 1; \
|
unsigned ans = 1; \
|
||||||
while ((_x_ /= 10) != 0) \
|
while ((_x_ /= 10) != 0) \
|
||||||
ans++; \
|
ans++; \
|
||||||
ans; \
|
ans; \
|
||||||
|
|||||||
@ -70,29 +70,12 @@
|
|||||||
UNIQ_T(A, aq) > UNIQ_T(B, bq) ? UNIQ_T(A, aq) : UNIQ_T(B, bq); \
|
UNIQ_T(A, aq) > UNIQ_T(B, bq) ? UNIQ_T(A, aq) : UNIQ_T(B, bq); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define IS_UNSIGNED_INTEGER_TYPE(type) \
|
/* evaluates to (void) if _A or _B are not constant or of different types */
|
||||||
(__builtin_types_compatible_p(typeof(type), unsigned char) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), unsigned short) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), unsigned) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), unsigned long) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), unsigned long long))
|
|
||||||
|
|
||||||
#define IS_SIGNED_INTEGER_TYPE(type) \
|
|
||||||
(__builtin_types_compatible_p(typeof(type), signed char) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), signed short) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), signed) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), signed long) || \
|
|
||||||
__builtin_types_compatible_p(typeof(type), signed long long))
|
|
||||||
|
|
||||||
/* Evaluates to (void) if _A or _B are not constant or of different types (being integers of different sizes
|
|
||||||
* is also OK as long as the signedness matches) */
|
|
||||||
#define CONST_MAX(_A, _B) \
|
#define CONST_MAX(_A, _B) \
|
||||||
(__builtin_choose_expr( \
|
(__builtin_choose_expr( \
|
||||||
__builtin_constant_p(_A) && \
|
__builtin_constant_p(_A) && \
|
||||||
__builtin_constant_p(_B) && \
|
__builtin_constant_p(_B) && \
|
||||||
(__builtin_types_compatible_p(typeof(_A), typeof(_B)) || \
|
__builtin_types_compatible_p(typeof(_A), typeof(_B)), \
|
||||||
(IS_UNSIGNED_INTEGER_TYPE(_A) && IS_UNSIGNED_INTEGER_TYPE(_B)) || \
|
|
||||||
(IS_SIGNED_INTEGER_TYPE(_A) && IS_SIGNED_INTEGER_TYPE(_B))), \
|
|
||||||
((_A) > (_B)) ? (_A) : (_B), \
|
((_A) > (_B)) ? (_A) : (_B), \
|
||||||
VOID_0))
|
VOID_0))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user