Skip to content

Commit 6b62e5e

Browse files
nvlsianpugalak
authored andcommitted
settings: remove dead code
Patch removes dead, replaced code which was accidentally not removed within the stream-codec PR #9521. Signed-off-by: Andrzej Puzdrowski <[email protected]>
1 parent bf8d391 commit 6b62e5e

File tree

2 files changed

+0
-84
lines changed

2 files changed

+0
-84
lines changed

subsys/settings/src/settings_line.c

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -18,83 +18,6 @@
1818
#include <logging/log.h>
1919
LOG_MODULE_DECLARE(settings, CONFIG_SETTINGS_LOG_LEVEL);
2020

21-
int settings_line_parse(char *buf, char **namep, char **valp)
22-
{
23-
char *cp;
24-
enum {
25-
FIND_NAME,
26-
FIND_NAME_END,
27-
FIND_VAL,
28-
FIND_VAL_END
29-
} state = FIND_NAME;
30-
31-
*valp = NULL;
32-
for (cp = buf; *cp != '\0'; cp++) {
33-
switch (state) {
34-
case FIND_NAME:
35-
if (!isspace((unsigned char)*cp)) {
36-
*namep = cp;
37-
state = FIND_NAME_END;
38-
}
39-
break;
40-
case FIND_NAME_END:
41-
if (*cp == '=') {
42-
*cp = '\0';
43-
state = FIND_VAL;
44-
} else if (isspace((unsigned char)*cp)) {
45-
*cp = '\0';
46-
}
47-
break;
48-
case FIND_VAL:
49-
if (!isspace((unsigned char)*cp)) {
50-
*valp = cp;
51-
state = FIND_VAL_END;
52-
}
53-
break;
54-
case FIND_VAL_END:
55-
if (isspace((unsigned char)*cp)) {
56-
*cp = '\0';
57-
}
58-
break;
59-
}
60-
}
61-
62-
if (state == FIND_VAL_END || state == FIND_VAL) {
63-
return 0;
64-
} else {
65-
return -1;
66-
}
67-
}
68-
69-
int settings_line_make(char *dst, int dlen, const char *name, const char *value)
70-
{
71-
int nlen;
72-
int vlen;
73-
int off;
74-
75-
nlen = strlen(name);
76-
77-
if (value) {
78-
vlen = strlen(value);
79-
} else {
80-
vlen = 0;
81-
}
82-
83-
if (nlen + vlen + 2 > dlen) {
84-
return -1;
85-
}
86-
87-
memcpy(dst, name, nlen);
88-
off = nlen;
89-
dst[off++] = '=';
90-
91-
memcpy(dst + off, value, vlen);
92-
off += vlen;
93-
dst[off] = '\0';
94-
95-
return off;
96-
}
97-
9821
struct settings_io_cb_s {
9922
int (*read_cb)(void *ctx, off_t off, char *buf, size_t *len);
10023
int (*write_cb)(void *ctx, off_t off, char const *buf, size_t len);

subsys/settings/src/settings_priv.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ struct mgmt_cbuf;
2222
int settings_cbor_line(struct mgmt_cbuf *cb, char *name, int nlen, char *value,
2323
int vlen);
2424

25-
int settings_line_parse(char *buf, char **namep, char **valp);
26-
int settings_line_make(char *dst, int dlen, const char *name, const char *val);
27-
int settings_line_make2(char *dst, int dlen, const char *name,
28-
const char *value);
29-
30-
31-
3225
void settings_line_io_init(int (*read_cb)(void *ctx, off_t off, char *buf,
3326
size_t *len),
3427
int (*write_cb)(void *ctx, off_t off,

0 commit comments

Comments
 (0)