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

Re: PATCH: Remove some unused assignments/checks noticed by clang



On 14 May 2011 02:23, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> Only two changes result in different code for me, curiously both of the
> ones in exec.c, even though they are trivially useless, while none of
> the other changes have any effect... That's gcc for you.
>
> Changes that might look strange on first inspection are the removals
> of the null checks in compresult.c, note that the first line after each
> loop does the same dereference anyway.
>
> There is a big thing removed in zle_tricky.c, yes, that really doesn't
> do anything.

> --- a/Src/module.c
> +++ b/Src/module.c
> @@ -426,14 +426,13 @@ static int
>  add_autobin(const char *module, const char *bnam, int flags)
>  {
>     Builtin bn;
> -    int ret;
>
>     bn = zshcalloc(sizeof(*bn));
>     bn->node.nam = ztrdup(bnam);
>     bn->optstr = ztrdup(module);
>     if (flags & FEAT_AUTOALL)
>        bn->node.flags |= BINF_AUTOALL;
> -    if ((ret = addbuiltin(bn))) {
> +    if (addbuiltin(bn)) {
>        builtintab->freenode(&bn->node);
>        if (!(flags & FEAT_IGNORE))
>            return 1;

Should this slightly out of view "return 0;" perhaps change to "return
ret;" instead?

-- 
Mikael Magnusson



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