Skip to content

Commit dc8c0a9

Browse files
a3fsaschahauer
authored andcommitted
parseopt: drop unused, duplicate, parseopt_u16
We always have sizeof(unsigned short) == sizeof(uint16_t), so parseopt_u16() is exactly equivalent to parseopt_hu(). The former is unused anyway, so just drop it. Signed-off-by: Ahmad Fatoum <[email protected]> Link: https://lore.barebox.org/[email protected] Signed-off-by: Sascha Hauer <[email protected]>
1 parent 1b0679d commit dc8c0a9

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

include/parseopt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ void parseopt_llu_suffix(const char *options, const char *opt,
66

77
void parseopt_b(const char *options, const char *opt, bool *val);
88
void parseopt_hu(const char *options, const char *opt, unsigned short *val);
9-
void parseopt_u16(const char *options, const char *opt, uint16_t *val);
109
void parseopt_str(const char *options, const char *opt, char **val);
1110

1211
#endif /* __PARSEOPT_H__ */

lib/parseopt.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,37 +59,6 @@ void parseopt_hu(const char *options, const char *opt, unsigned short *val)
5959
*val = v;
6060
}
6161

62-
void parseopt_u16(const char *options, const char *opt, uint16_t *val)
63-
{
64-
const char *start;
65-
size_t optlen = strlen(opt);
66-
ulong v;
67-
char *endp;
68-
69-
again:
70-
start = strstr(options, opt);
71-
72-
if (!start)
73-
return;
74-
75-
if (start > options && start[-1] != ',') {
76-
options = start;
77-
goto again;
78-
}
79-
80-
if (start[optlen] != '=') {
81-
options = start;
82-
goto again;
83-
}
84-
85-
v = simple_strtoul(start + optlen + 1, &endp, 0);
86-
if (v > U16_MAX)
87-
return;
88-
89-
if (*endp == ',' || *endp == '\0')
90-
*val = v;
91-
}
92-
9362
void parseopt_str(const char *options, const char *opt, char **val)
9463
{
9564
const char *start;

0 commit comments

Comments
 (0)