Hi Frank,

On Wed, 2021-12-08 at 10:32 -0500, Frank Ch. Eigler wrote:
> except:
> 
> > -  *size = os.size();
> > -  MHD_add_response_header (r, "Content-Type", "text/plain");
> > +  if (r != NULL)
> > +    {
> > +      *size = os.size();
> > +      add_mhd_response_header (r, "Content-Type", "text/plain");
> > +    }
> 
> Why move the *size assignment in there?
> 
> 
> > -  *size = version.size ();
> > -  MHD_add_response_header (r, "Content-Type", "text/plain");
> > +  if (r != NULL)
> > +    {
> > +      *size = version.size ();
> > +      add_mhd_response_header (r, "Content-Type", "text/plain");
> > +    }
> >    return r;
> >  }
> 
> ditto?

Because both statements are unnecessary if r == NULL (aka the response
couldn't even be created). Filling in size would also be lying to the
caller (who has to check the returned response isn't NULL anyway - and
does, I just checked :)

But it is also harmless to do, so if you want I can move it outside the
if statement.

Cheers,

Mark

Reply via email to