Commit 3fe07807 authored by Niels Möller's avatar Niels Möller
Browse files

(sexp_vformat): Handle %( and %).

Rev: src/nettle/sexp-format.c:1.8
Rev: src/nettle/sexp.h:1.14
parent 27889a95
...@@ -146,6 +146,14 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) ...@@ -146,6 +146,14 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
default: default:
abort(); abort();
case '(':
case ')':
/* Allow unbalanced parenthesis */
if (buffer && !NETTLE_BUFFER_PUTC(buffer, format[-1]))
return 0;
done++;
break;
case 's': case 's':
{ {
const char *s; const char *s;
......
...@@ -153,14 +153,15 @@ struct nettle_buffer; ...@@ -153,14 +153,15 @@ struct nettle_buffer;
* subexpression. Represented as unsigned length, const uint8_t * subexpression. Represented as unsigned length, const uint8_t
* *data. * *data.
* *
* %(, %) Allows insertion of unbalanced parenthesis.
*
* Modifiers: * Modifiers:
* *
* %0 For %s, %t and %l, says that there's no length argument, * %0 For %s, %t and %l, says that there's no length argument,
* instead the string is NUL-terminated, and there's only one * instead the string is NUL-terminated, and there's only one
* const uint8_t * argument. * const uint8_t * argument.
* */
* FIXME: Allow "%(" for unbalanced parenthesis. */
unsigned unsigned
sexp_format(struct nettle_buffer *buffer, sexp_format(struct nettle_buffer *buffer,
const char *format, ...); const char *format, ...);
......
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