1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-18 19:41:01 -05:00

Macro wrapper on ctrl_radiobuttons to fill in the NULL.

ctrl_radiobuttons has a variadic argument list that it expects to be
terminated by a null pointer where a const char * should be. So the
terminating NULL at each call site ought to be cast to const char *,
for the usual reason (NULL might expand literally to something not the
same size as a pointer and get mis-marshalled in the variadic argument
list). It wasn't being.

Fixed in the same way as dupcat: I've turned ctrl_radiobuttons into a
macro wrapper on the underlying function, which adds the NULL
automatically with its correct cast. This also saves verbiage at every
call site, because now I can leave out all the NULLs there.
This commit is contained in:
Simon Tatham
2022-06-01 11:14:21 +01:00
parent 5a28658a6d
commit e0959d4647
4 changed files with 47 additions and 55 deletions

View File

@ -532,9 +532,11 @@ dlgcontrol *ctrl_combobox(struct controlset *, const char *label,
* title is expected to be followed by a shortcut _iff_ `shortcut'
* is NO_SHORTCUT.
*/
dlgcontrol *ctrl_radiobuttons(struct controlset *, const char *label,
char shortcut, int ncolumns, intorptr helpctx,
handler_fn handler, intorptr context, ...);
dlgcontrol *ctrl_radiobuttons_fn(struct controlset *, const char *label,
char shortcut, int ncolumns, intorptr helpctx,
handler_fn handler, intorptr context, ...);
#define ctrl_radiobuttons(...) \
ctrl_radiobuttons_fn(__VA_ARGS__, (const char *)NULL)
dlgcontrol *ctrl_pushbutton(struct controlset *, const char *label,
char shortcut, intorptr helpctx,
handler_fn handler, intorptr context);