> Module Name:    src
> Committed By:   sjg
> Date:           Sat Feb 25 22:52:22 UTC 2023
> 
> Modified Files:
>         src/usr.bin/make: meta.c
> 
> Log Message:
> meta.c: use macro to access job->bm
> 
> and if job is NULL use Mybm.

> +#define BM(job) (job != NULL) ? &job->bm : &Mybm

If this must be a macro, it should have more parentheses to avoid
confusion at use sites:

#define BM(job) (((job) != NULL) ? &(job)->bm : &Mybm)

As is, for instance,

        BM(jobarray + i)

or

        BM(job)->member

will do the wrong thing (perhaps with a compile error but needlessly
confusing nonetheless).

That said, I don't see any reason why this should be a macro in the
first place.  If there is a compelling reason, please write it down;
if not, please change it to a static function:

static BuildMon *
BM(Job *job)
{

        return (job != NULL ? &job->bm : &Mypbm);
}

Reply via email to