Re: [GSoC][PATCH 2/3] rebase -i: rewrite setup_reflog_action() in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stefan,

On Mon, 18 Jun 2018, Stefan Beller wrote:

> On Mon, Jun 18, 2018 at 6:19 AM Alban Gruin <alban.gruin@xxxxxxxxx> wrote:
> >
> > +int setup_reflog_action(struct replay_opts *opts, const char *commit,
> > +                       int verbose)
> > +{
> > +       const char *action;
> > +
> > +       if (commit && *commit) {
> 
> While this is defensive programming (checking the pointer before dereferencing
> it, the first condition (commit == NULL) should never be false here,
> as the caller
> checks for argc == 2 ?

But it is not marked as `static` (or is it?). So we should not rely on the
caller to Do The Right Thing.

Ciao,
Dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux