[ntp:hackers] [PATCH] ntp:libntp: Remove unnecessary brace

Harlan Stenn stenn at ntp.org
Sat Jun 20 19:59:42 UTC 2015


Hi Masanari,

(Do you prefer Iida-san?)

Masanari Iida writes:
> On Sun, Jun 21, 2015 at 2:54 AM, Harlan Stenn <stenn at ntp.org> wrote:
> > Masanari,
> >
> > Thanks for the patch.  Please submit it using our bugzilla, or if you
> > must, you can be the first person to submit a pull request on github.
> >
> > Bugzilla is far easier on me.
> >
> Hello Harian,
> 
> I sent this patch the way I did in other project, just because I am not famil
> iar
> with how to submitting a patch to ntp dev list.
> I prefer to open bugzilla case.

Thank you!

> > Pull requests will be easier when we have more developers.
> >
> > Are you actually building NTP for a system that doesn't have strdup()?
> >
> > That bug came from a change in 2010, so I'm inclined to believe nobody
> > has actually used that code since then.
> >
> I found this when I run a tool called "cppcheck"
> http://cppcheck.sourceforge.net/
> 
> This tool may suggest some possible errors such as
> "uninitialized value",  "Resource leak",  "possible null pointer",
> "Array accessed at index, which is out of bouds",."memory leak"  and
> "syntax error".
> 
> I suggest to run this type of static code checker to find out possible
> errors.  And if you find false positive, please report to the cppcheck
> dev. :)

Is it OK with you if I open a bugzilla report with your above suggestion
and list you as a Cc: on that report?

Thanks again!

H
--
> Masanari
> 
> > H
> >
> > Masanari Iida writes:
> >> cppcheck reports following error.
> >>
> >> [libntp/strdup.c:14]: (error) Invalid number of character
> >> ({) when these macros are defined: ''
> >>
> >> This patch removes unnecessary brace.
> >>
> >> Signed-off-by: Masanari Iida <standby24x7 at gmail.com>
> >> ---
> >>  libntp/strdup.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/libntp/strdup.c b/libntp/strdup.c
> >> index f7565a2..1b09c8a 100644
> >> --- a/libntp/strdup.c
> >> +++ b/libntp/strdup.c
> >> @@ -15,7 +15,7 @@ strdup(
> >>       size_t  octets;
> >>       char *  cp;
> >>
> >> -     if (s) {
> >> +     if (s)
> >>               octets = 1 + strlen(s);
> >>               cp = malloc(octets);
> >>               if (NULL != cp)
> >> --
> >> 2.4.4.408.g16da57c
> >>
> >>
> 


More information about the hackers mailing list