This website requires JavaScript.
Explore
Help
Register
Sign In
mirrors
/
systemd
Watch
0
Star
0
Fork
0
You've already forked systemd
mirror of
https://github.com/systemd/systemd.git
synced
2025-01-24 17:33:43 +08:00
Code
Issues
Packages
Projects
Releases
Wiki
Activity
ca3f47eff3
systemd
/
coccinelle
/
const-strlen.disabled
15 lines
107 B
Plaintext
Raw
Normal View
History
Unescape
Escape
tree-wide: make use of new STRLEN() macro everywhere (#7639) Let's employ coccinelle to do this for us. Follow-up for #7625.
2017-12-15 02:02:29 +08:00
@@
constant s;
@@
coccinelle: ignore macro transformations in the macros themselves For example, the following transformation: - sizeof(s)-1 + STRLEN(s) would replace sizeof by STRLEN even in the STRLEN macro definition itself, which generates following nonsensical patch: --- src/basic/macro.h +++ /tmp/cocci-output-8753-b50773-macro.h @@ -182,7 +182,7 @@ static inline unsigned long ALIGN_POWER2 * Contrary to strlen(), this is a constant expression. * @x: a string literal. */ -#define STRLEN(x) (sizeof(""x"") - 1) +#define STRLEN(x) (STRLEN("" x "")) /* * container_of - cast a member of a structure out to the containing structure Let's exclude the macro itself from the transformation to avoid this
2019-04-28 21:03:47 +08:00
(
#define STRLEN
&
tree-wide: make use of new STRLEN() macro everywhere (#7639) Let's employ coccinelle to do this for us. Follow-up for #7625.
2017-12-15 02:02:29 +08:00
- sizeof(s)-1
+ STRLEN(s)
coccinelle: ignore macro transformations in the macros themselves For example, the following transformation: - sizeof(s)-1 + STRLEN(s) would replace sizeof by STRLEN even in the STRLEN macro definition itself, which generates following nonsensical patch: --- src/basic/macro.h +++ /tmp/cocci-output-8753-b50773-macro.h @@ -182,7 +182,7 @@ static inline unsigned long ALIGN_POWER2 * Contrary to strlen(), this is a constant expression. * @x: a string literal. */ -#define STRLEN(x) (sizeof(""x"") - 1) +#define STRLEN(x) (STRLEN("" x "")) /* * container_of - cast a member of a structure out to the containing structure Let's exclude the macro itself from the transformation to avoid this
2019-04-28 21:03:47 +08:00
)
tree-wide: make use of new STRLEN() macro everywhere (#7639) Let's employ coccinelle to do this for us. Follow-up for #7625.
2017-12-15 02:02:29 +08:00
@@
constant s;
@@
- strlen(s)
+ STRLEN(s)
Reference in New Issue
Copy Permalink