Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions

Tom Tromey
2013-11-08T16:13:58Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> + if (regexp != NULL)
Joel> + {
Joel> + preg = alloca (sizeof (regex_t));
>>
>> I think regex_t is sufficiently small that you might as well declare an
>> object in the outer scope and avoid alloca.

Joel> Sure, I can do that. I found this to be a fairly interesting
Joel> approach, because it avoids the need to check regexp repeatedly
Joel> in order to decide whether to pass &preg, or NULL.

You can keep preg and set it to point to the real object in the 'if'.

Tom