Commit d7b2d9df02631e6f0ecbfbc4a4e01459d57d0d98
Committed by
Tom Rini
1 parent
3ea664c7c3
Exists in
v2017.01-smarct4x
and in
37 other branches
lib:vsprintf: reduce scope of pack_hex_byte
pack_hex_byte is only used when CONFIG_CMD_NET is defined so limit it to that scope. This prevents a clang warning. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Showing 1 changed file with 11 additions and 11 deletions Side-by-side Diff
lib/vsprintf.c
... | ... | @@ -28,17 +28,6 @@ |
28 | 28 | /* some reluctance to put this into a new limits.h, so it is here */ |
29 | 29 | #define INT_MAX ((int)(~0U>>1)) |
30 | 30 | |
31 | -static const char hex_asc[] = "0123456789abcdef"; | |
32 | -#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] | |
33 | -#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] | |
34 | - | |
35 | -static inline char *pack_hex_byte(char *buf, u8 byte) | |
36 | -{ | |
37 | - *buf++ = hex_asc_hi(byte); | |
38 | - *buf++ = hex_asc_lo(byte); | |
39 | - return buf; | |
40 | -} | |
41 | - | |
42 | 31 | unsigned long simple_strtoul(const char *cp, char **endp, |
43 | 32 | unsigned int base) |
44 | 33 | { |
... | ... | @@ -434,6 +423,17 @@ |
434 | 423 | } |
435 | 424 | |
436 | 425 | #ifdef CONFIG_CMD_NET |
426 | +static const char hex_asc[] = "0123456789abcdef"; | |
427 | +#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] | |
428 | +#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] | |
429 | + | |
430 | +static inline char *pack_hex_byte(char *buf, u8 byte) | |
431 | +{ | |
432 | + *buf++ = hex_asc_hi(byte); | |
433 | + *buf++ = hex_asc_lo(byte); | |
434 | + return buf; | |
435 | +} | |
436 | + | |
437 | 437 | static char *mac_address_string(char *buf, char *end, u8 *addr, int field_width, |
438 | 438 | int precision, int flags) |
439 | 439 | { |