Commit 2039f20a authored by Niels Möller's avatar Niels Möller

* sexp-format.c (sexp_vformat): Allow whitespace in format string.

Rev: src/nettle/sexp-format.c:1.7
Rev: src/nettle/sexp.h:1.13
parent df200717
...@@ -97,7 +97,7 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) ...@@ -97,7 +97,7 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
default: default:
{ {
const char *start = format - 1; const char *start = format - 1;
unsigned length = 1 + strcspn(format, "()%"); unsigned length = 1 + strcspn(format, "()% \t");
unsigned output_length = format_string(buffer, length, start); unsigned output_length = format_string(buffer, length, start);
if (!output_length) if (!output_length)
return 0; return 0;
...@@ -107,6 +107,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) ...@@ -107,6 +107,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
break; break;
} }
case ' ': case '\t':
break;
case '\0': case '\0':
assert(!nesting); assert(!nesting);
......
...@@ -135,7 +135,8 @@ struct nettle_buffer; ...@@ -135,7 +135,8 @@ struct nettle_buffer;
* buffer == NULL, just compute length. * buffer == NULL, just compute length.
* *
* Format strings can contained matched parentheses, tokens ("foo" in * Format strings can contained matched parentheses, tokens ("foo" in
* the format string is formatted as "3:foo"), and the following * the format string is formatted as "3:foo"), whitespace (which
* separates tokens but is otherwise ignored) and the following
* formatting specifiers: * formatting specifiers:
* *
* %s String represented as unsigned length, const uint8_t *data. * %s String represented as unsigned length, const uint8_t *data.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment