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

Re: [PATCH] find RLIM_NLIMITS correctly on Cygwin

Jun T wrote on Mon, 23 Mar 2020 14:41 +0900:
> Changes to the data in known_resouces is done via the pointer current_letter:
> char *current_letter = &known_resources[i].opt;
> Constness of resinfo does not interfere with this.


> # and the data for unknown resource (if any) is setup using the pointer
> # resinfo_T *info = (resinfo_T *)zshcalloc(sizeof(resinfo_T));
> # and the assignment "resinfo[i] = info" does not conflict with the
> # constness of resinfo.

I agree about the assignment, but that allocation won't run for the case
at hand, will it?  In the second for loop, «resinfo[i]» (in the 'if'
condition) will be non-NULL; it will point to an element of
«known_resources» whose «opt» member will have been changed to 'N' by
the first for loop.

> Using resinfo instead of resinfo_mutable gives no warning for me
> (gcc on Linux and clang on macOS).
> Do we really need resinfo_mutable?

I guess not.  That must be a relic from an earlier draft of that patch.
I will fix it if we decide to add the runtime verification.  Thanks for
the review. :-)



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