Commit 700c48b
committed
modpost: use null string instead of NULL pointer for default namespace
The default namespace is the null string, "".
When set, the null string "" is converted to NULL:
s->namespace = namespace[0] ? NOFAIL(strdup(namespace)) : NULL;
When printed, the NULL pointer is get back to the null string:
sym->namespace ?: ""
This saves 1 byte memory allocated for "", but loses the readability.
In kernel-space, we strive to save memory, but modpost is a userspace
tool used to build the kernel. On modern systems, such small piece of
memory is not a big deal.
Handle the namespace string as is.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>1 parent 6e7611c commit 700c48b
1 file changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
303 | 310 | | |
304 | 311 | | |
305 | 312 | | |
| |||
369 | 376 | | |
370 | 377 | | |
371 | 378 | | |
372 | | - | |
| 379 | + | |
373 | 380 | | |
374 | 381 | | |
375 | 382 | | |
| |||
1829 | 1836 | | |
1830 | 1837 | | |
1831 | 1838 | | |
1832 | | - | |
1833 | | - | |
| 1839 | + | |
1834 | 1840 | | |
1835 | 1841 | | |
1836 | 1842 | | |
| |||
1916 | 1922 | | |
1917 | 1923 | | |
1918 | 1924 | | |
1919 | | - | |
1920 | | - | |
| 1925 | + | |
1921 | 1926 | | |
1922 | 1927 | | |
1923 | 1928 | | |
| |||
2185 | 2190 | | |
2186 | 2191 | | |
2187 | 2192 | | |
2188 | | - | |
| 2193 | + | |
2189 | 2194 | | |
2190 | 2195 | | |
2191 | 2196 | | |
| |||
0 commit comments