List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:September 11 2008 10:46pm
Subject:Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763
View as plain text  
Konstantin Osipov wrote:
> * Davi Arnaut <Davi.Arnaut@stripped> [08/09/12 02:26]:
>> Konstantin Osipov wrote:
>>> * Davi Arnaut <Davi.Arnaut@stripped> [08/09/12 00:30]:
>>>>> +          bzero((char*) &table_list,sizeof(table_list));
>>>> Use memset.
>>> No offense, but this bikeshed  is a bit annoyed.
>>>
>>> MySQL has its own implementation of bzero in mysys, so it's
>>> kosher.
>>>
>> Dear Mr. Osipov,
>>
>> I normally nag at it because it reveals copy-and-paste attitude and it
>> requires a noisy cast because the function is so old and broken that
>> some implementations take the first argument as a char pointer and
>> others as a void pointer, nonetheless, it's also a deprecated function.
>>
>> OTOH, memset is pretty straightforward and many compilers will optimize
>> it away without any trouble. So, I'll keep being a douche every time I
>> see deprecated functions being used for no good reason.
> 
> Part of the coding style, added by Monty ages ago:
> 
> * Use libstring functions (in the strings directory) instead of
> standard libc string functions whenever possible. For example, use
> bfill() and bzero() instead of memset().

It's under the "Additional suggestions" heading and I only take
seriously suggestions that actually make sense.

> 
> :-p
> 
> Now, all this time it just worked.

I didn't say it doesn't work (but it might break in some cases).

> Bikeshed it is.

I say it is poor judgment on your behalf :). Did you know that bzero.c
is unused (it's not even compiled) and that most of the time bzero is a
define to memset?

-- Davi
Thread
bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Sergey Glukhov5 Sep
  • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Davi Arnaut11 Sep
    • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Konstantin Osipov11 Sep
      • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Davi Arnaut12 Sep
        • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Konstantin Osipov12 Sep
          • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Konstantin Osipov12 Sep
            • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Davi Arnaut12 Sep
              • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Konstantin Osipov12 Sep
                • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Davi Arnaut12 Sep
          • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Davi Arnaut12 Sep
            • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Konstantin Osipov12 Sep
              • Re: bzr commit into mysql-5.0 branch (gluh:2678) Bug#22763Davi Arnaut12 Sep