macro: add STRLITERALLEN() and STRARRAYLEN()

sizeof() implementation for string literals and string arrays that makes
it behave like strlen() for strings.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-09-22 11:14:08 +02:00
parent b857f4be4f
commit 36dee4a2b6
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -348,4 +348,7 @@ extern int __build_bug_on_failed;
#define LXC_INVALID_UID ((uid_t)-1)
#define LXC_INVALID_GID ((gid_t)-1)
#define STRLITERALLEN(x) (sizeof(""x"") - 1)
#define STRARRAYLEN(x) (sizeof(x) - 1)
#endif /* __LXC_MACRO_H */