vec_free (s);
return 0;
}
+ /* Make sure something was processed. */
+ else if (s == 0)
+ {
+ return 0;
+ }
*hexstring_return = s;
return 1;
}
*result = line;
- return 1;
+ return vec_len (line);
}
/* Parse a line ending with \n and return it as an unformat_input_t. */
{
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;
}
return 0;
}
-static char *
-match_input_with_format (unformat_input_t * input, char *f)
+static const char *
+match_input_with_format (unformat_input_t * input, const char *f)
{
uword cf, ci;
return f;
}
-static char *
-do_percent (unformat_input_t * input, va_list * va, char *f)
+static const char *
+do_percent (unformat_input_t * input, va_list * va, const char *f)
{
uword cf, n, data_bytes = ~0;
}
uword
-va_unformat (unformat_input_t * input, char *fmt, va_list * va)
+va_unformat (unformat_input_t * input, const char *fmt, va_list * va)
{
- char *f;
+ const char *f;
uword input_matches_format;
uword default_skip_input_white_space;
uword n_input_white_space_skipped;
else
{
- char *g = match_input_with_format (input, f);
+ const char *g = match_input_with_format (input, f);
if (!g)
goto parse_fail;
last_non_white_space_match_format = g > f;
}
uword
-unformat (unformat_input_t * input, char *fmt, ...)
+unformat (unformat_input_t * input, const char *fmt, ...)
{
va_list va;
uword result;