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

Masanari Iida standby24x7 at gmail.com
Sat Jun 20 18:53:24 UTC 2015


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 familiar
with how to submitting a patch to ntp dev list.
I prefer to open bugzilla case.

> 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. :)

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