1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-22 14:39:24 -05:00

testcrypt: add return_val_string_asciz_const.

A partial cherry-pick of commit 5cfc90ff0de9d51c1556186e4935e9f4cb0cb7a0
keeping just the one function I need on this branch.
This commit is contained in:
Simon Tatham 2020-01-06 19:58:25 +00:00
parent d51b3d7eb6
commit 3b1f458a0d

View File

@ -495,14 +495,19 @@ static void return_boolean(strbuf *out, bool b)
strbuf_catf(out, "%s\n", b ? "true" : "false"); strbuf_catf(out, "%s\n", b ? "true" : "false");
} }
static void return_val_string_asciz(strbuf *out, char *s) static void return_val_string_asciz_const(strbuf *out, const char *s)
{ {
strbuf *sb = strbuf_new(); strbuf *sb = strbuf_new();
put_data(sb, s, strlen(s)); put_data(sb, s, strlen(s));
sfree(s);
return_val_string(out, sb); return_val_string(out, sb);
} }
static void return_val_string_asciz(strbuf *out, char *s)
{
return_val_string_asciz_const(out, s);
sfree(s);
}
#define NULLABLE_RETURN_WRAPPER(type_name, c_type) \ #define NULLABLE_RETURN_WRAPPER(type_name, c_type) \
static void return_opt_##type_name(strbuf *out, c_type ptr) \ static void return_opt_##type_name(strbuf *out, c_type ptr) \
{ \ { \