Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: local_traps doesn't restore traps set from functions



Roman Perepelitsa wrote on Fri, 08 May 2020 08:51 +0200:
> On Thu, May 7, 2020 at 11:21 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > The following patch fixes it:  
> 
> Thanks for the patch. I confirm that it works. I've tried a handful of
> different combinations of traps and all work as expected.
> 

Thanks for testing.

> One stylistic suggestion for the patch: replace sigtrapped[i] fixup with this:
> 
>     sigtrapped[i] -= 1 << ZSIG_SHIFT;
> 
> It'll align the code with the preceding comment to the point of making
> the comment superfluous. I also find it easier to understand although
> that may be subjective.

Good point, thanks.  Perhaps it'd be clearer if I wrapped the first
disjunct by a macro, so it'd have a name and a doc string:

/* ... */
static unsigned int low_N_bits_of(unsigned arg, unsigned char N) { return arg & ((1u << N)-1u); }

(Function, rather than macro, for type safety in case the arguments are
passed in the wrong order.)

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author