Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
VPP-1381: Fix the incorrect if condition when delete session for static mapping
[vpp.git]
/
src
/
vppinfra
/
unformat.c
diff --git
a/src/vppinfra/unformat.c
b/src/vppinfra/unformat.c
index
ac8b7dd
..
e30c6d3
100644
(file)
--- a/
src/vppinfra/unformat.c
+++ b/
src/vppinfra/unformat.c
@@
-306,6
+306,11
@@
unformat_hex_string (unformat_input_t * input, va_list * va)
vec_free (s);
return 0;
}
vec_free (s);
return 0;
}
+ /* Make sure something was processed. */
+ else if (s == 0)
+ {
+ return 0;
+ }
*hexstring_return = s;
return 1;
*hexstring_return = s;
return 1;
@@
-396,7
+401,7
@@
unformat_line (unformat_input_t * i, va_list * va)
}
*result = line;
}
*result = line;
- return
1
;
+ return
vec_len (line)
;
}
/* Parse a line ending with \n and return it as an unformat_input_t. */
}
/* Parse a line ending with \n and return it as an unformat_input_t. */
@@
-405,7
+410,8
@@
unformat_line_input (unformat_input_t * i, va_list * va)
{
unformat_input_t *result = va_arg (*va, unformat_input_t *);
u8 *line;
{
unformat_input_t *result = va_arg (*va, unformat_input_t *);
u8 *line;
- unformat_user (i, unformat_line, &line);
+ if (!unformat_user (i, unformat_line, &line))
+ return 0;
unformat_init_vector (result, line);
return 1;
}
unformat_init_vector (result, line);
return 1;
}
@@
-681,8
+687,8
@@
error:
return 0;
}
return 0;
}
-static char *
-match_input_with_format (unformat_input_t * input, char *f)
+static c
onst c
har *
+match_input_with_format (unformat_input_t * input, c
onst c
har *f)
{
uword cf, ci;
{
uword cf, ci;
@@
-703,8
+709,8
@@
match_input_with_format (unformat_input_t * input, char *f)
return f;
}
return f;
}
-static char *
-do_percent (unformat_input_t * input, va_list * va, char *f)
+static c
onst c
har *
+do_percent (unformat_input_t * input, va_list * va, c
onst c
har *f)
{
uword cf, n, data_bytes = ~0;
{
uword cf, n, data_bytes = ~0;
@@
-824,9
+830,9
@@
unformat_skip_white_space (unformat_input_t * input)
}
uword
}
uword
-va_unformat (unformat_input_t * input, char *fmt, va_list * va)
+va_unformat (unformat_input_t * input, c
onst c
har *fmt, va_list * va)
{
{
- char *f;
+ c
onst c
har *f;
uword input_matches_format;
uword default_skip_input_white_space;
uword n_input_white_space_skipped;
uword input_matches_format;
uword default_skip_input_white_space;
uword n_input_white_space_skipped;
@@
-937,7
+943,7
@@
va_unformat (unformat_input_t * input, char *fmt, va_list * va)
else
{
else
{
- char *g = match_input_with_format (input, f);
+ c
onst c
har *g = match_input_with_format (input, f);
if (!g)
goto parse_fail;
last_non_white_space_match_format = g > f;
if (!g)
goto parse_fail;
last_non_white_space_match_format = g > f;
@@
-963,7
+969,7
@@
parse_fail:
}
uword
}
uword
-unformat (unformat_input_t * input, char *fmt, ...)
+unformat (unformat_input_t * input, c
onst c
har *fmt, ...)
{
va_list va;
uword result;
{
va_list va;
uword result;
@@
-1031,7
+1037,7
@@
unformat_init_vector (unformat_input_t * input, u8 * vector_string)
#ifdef CLIB_UNIX
static uword
#ifdef CLIB_UNIX
static uword
-
unix
_file_fill_buffer (unformat_input_t * input)
+
clib
_file_fill_buffer (unformat_input_t * input)
{
int fd = pointer_to_uword (input->fill_buffer_arg);
uword l, n;
{
int fd = pointer_to_uword (input->fill_buffer_arg);
uword l, n;
@@
-1049,9
+1055,9
@@
unix_file_fill_buffer (unformat_input_t * input)
}
void
}
void
-unformat_init_
unix
_file (unformat_input_t * input, int file_descriptor)
+unformat_init_
clib
_file (unformat_input_t * input, int file_descriptor)
{
{
- unformat_init (input,
unix
_file_fill_buffer,
+ unformat_init (input,
clib
_file_fill_buffer,
uword_to_pointer (file_descriptor, void *));
}
uword_to_pointer (file_descriptor, void *));
}