|
From: | Paul Eggert |
Subject: | bug#28859: Segmentation fault with NULL pointer dereference in 'stty' |
Date: | Tue, 17 Oct 2017 11:28:51 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 10/17/2017 12:37 AM, Pádraig Brady wrote:
+#define check_argument(arg) \ + if (k == n_settings - 1 || ! settings[k+1]) \ + { \ + error (0, 0, _("missing argument to %s"), quote (arg)); \ + usage (EXIT_FAILURE); \ + }
How about making this a static function instead of a macro? I am leery of macros for all the usual reasons. Admittedly the static function will also need k, n_settings, and settings as arguments; still, it seems cleaner to me overall.
If you do keep it a macro, please put it inside a do...while so that it doesn't cause problems as a then-part with a following else.
[Prev in Thread] | Current Thread | [Next in Thread] |