macro: add STRLITERALLEN() and STRARRAYLEN()

sizeof() implementation for string literals and string arrays that makes it behave like strlen() for strings. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 4cbbb135
...@@ -348,4 +348,7 @@ extern int __build_bug_on_failed; ...@@ -348,4 +348,7 @@ extern int __build_bug_on_failed;
#define LXC_INVALID_UID ((uid_t)-1) #define LXC_INVALID_UID ((uid_t)-1)
#define LXC_INVALID_GID ((gid_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 */ #endif /* __LXC_MACRO_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment