List:Internals« Previous MessageNext Message »
From:Chad MILLER Date:April 20 2007 1:36am
Subject:Re: Review 1 of patch 2 for #27894: mysqlbinlog formats timestamp wrong in comment
View as plain text  
On 19 Apr 2007, at 19:11, Jorge Bernal Ordovás wrote:

>
> On 19/04/2007, at 15:58, Chad MILLER wrote:
>>
>> Tabs again.  :\  ':set expandtabs" if you're using vi.
>>
> Oops, I configured my text editor, but I guess those where from the  
> first changes
>
>> I hate to see the magical value "17".  I'm ashamed to see it in  
>> the surrounding code.
>>
>> But, in this case, it's not the same "17" -- the others are  
>> locations to represent numbers, whereas this is padding.  "% 
>> 09000d" is at least legal, though unlikely, right?  That would try  
>> to write 8983 bytes past the end of buffz.
>>
>> I suggest making a for-loop and write chunks of padding or (I  
>> don't like as much) use my_alloca() to allocate one up front, and  
>> pack it, and then write it.
>
> I think the second case is what I was looking for. Anyway, is there  
> anything bad about doing a for-loop and my_b_write(info, '0', 1) in  
> terms or perfomance. Or it's just it feels wrong (I get that  
> feeling but not sure why yet)?

Yeah, system calls are expensive, so I'd suggest something like...

   const char zeroes[]=  
"000000000000000000000000000000000000000000000000";  /* some known  
block size */
and one for spaces,

   char *padding;

   if ...
      padding= zeroes;

    int i;
    for (i = minimum_width - length2; i > block_size; i -= block_size)
       my_b_write(info, padding, block_size);
     my_b_write(info, padding, i);


...or something like that.  I haven't tested this; it's just a rough  
idea.  What do you think?

- chad

--
Chad Miller, Software Developer                         chad@stripped
MySQL Inc., www.mysql.com
Orlando, Florida, USA                                13-20z,  UTC-0400
Office: +1 408 213 6740                         sip:6740@stripped



Attachment: [application/pgp-signature] This is a digitally signed message part PGP.sig
Thread
[PATCH] Proposed patch for #27894: mysqlbinlog formats timestamp wrong in commentJorge Bernal19 Apr
Re: [PATCH] Proposed patch for #27894: mysqlbinlog formats timestamp wrong in commentJorge Bernal Ordovás19 Apr
  • Review 1 of patch 1 for #27894: mysqlbinlog formats timestamp wrong in commentChad MILLER19 Apr
    • Re: Review 1 of patch 1 for #27894: mysqlbinlog formats timestamp wrong in commentJorge Bernal Ordovás19 Apr
      • Review 1 of patch 2 for #27894: mysqlbinlog formats timestamp wrong in commentChad MILLER20 Apr
        • Re: Review 1 of patch 2 for #27894: mysqlbinlog formats timestamp wrong in commentJorge Bernal Ordovás20 Apr
          • Re: Review 1 of patch 2 for #27894: mysqlbinlog formats timestamp wrong in commentChad MILLER20 Apr
            • Re: Review 1 of patch 2 for #27894: mysqlbinlog formats timestamp wrong in commentSergei Golubchik20 Apr
        • Re: Review 1 of patch 2 for #27894: mysqlbinlog formats timestamp wrong in commentJorge Bernal Ordovás20 Apr
          • Patch 3 for #27894: mysqlbinlog formats timestamp wrong in commentChad MILLER20 Apr
            • Re: Patch 3 for #27894: mysqlbinlog formats timestamp wrong incommentLenz Grimmer22 Apr
              • Re: Patch 3 for #27894: mysqlbinlog formats timestamp wrong in commentJorge Bernal Ordovás22 Apr
                • Re: Patch 3 for #27894: mysqlbinlog formats timestamp wrong incommentLenz Grimmer23 Apr
  • Re: [PATCH] Proposed patch for #27894: mysqlbinlog formats timestamp wrong in commentJorge Bernal Ordovás19 Apr