List:Commits« Previous MessageNext Message »
From:Dmitry Shulga Date:January 28 2011 2:17pm
Subject:Re: bzr commit into mysql-5.1 branch (Dmitry.Shulga:3564) Bug#57450
View as plain text  
Hi Sergey.

> Hi Dmitry,
> 
> the patch looks nice - I like this idea of moving "truncated" flag
> to line buffer structure. But please find comments inline...
> 
>> +    if (!line)
>>     {
>> -      status.exit_status=0;
>> +      if (status.line_buff->error)
>> +        status.exit_status= 1;
>> +      else
>> +        status.exit_status= 0;
>>       break;
>>     }
> What if status.line_buff is NULL here?
I don't see how can a status.line_buff have a NULL value in this place. If you have a test
case where status.line_buff have a NULL value 
please add new bug report.

 
> 
> Besides, exit_status seem to be initialized to 1 by default.
Yes, by default exit_status is set to 1. 
Nevertheless, I think that explicit assignment of status.exit_status to 1 or 0 make this
code snippet clearer

>> 
>> @@ -1976,7 +1979,8 @@ static int read_and_execute(bool interac
>> #endif
>>       continue;
>>     }
>> -    if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated))
>> +    if (add_line(glob_buffer,line,&in_string,&ml_comment,
>> +                 status.line_buff->truncated))
> Coding style: add space after comma.
Done

>> -char *batch_readline(LINE_BUFFER *line_buff, bool *truncated)
>> +char *batch_readline(LINE_BUFFER *line_buff)
>> {
>>   char *pos;
>>   ulong out_length;
>> -  DBUG_ASSERT(truncated != NULL);
>> 
>> -  if (!(pos=intern_read_line(line_buff,&out_length, truncated)))
>> +  if (!(pos=intern_read_line(line_buff,&out_length)))
> Coding style: add space after comma.
Done

>> -char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated)
>> +char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length)
>> {
>>   char *pos;
>>   size_t length;
>> @@ -214,22 +219,25 @@ char *intern_read_line(LINE_BUFFER *buff
>>     if (pos == buffer->end)
>>     {
>>       /*
>> -        fill_buffer() can return 0 either on EOF in which case we abort
>> -        or when the internal buffer has hit the size limit. In the latter case
>> -        return what we have read so far and signal string truncation.
>> +        fill_buffer() can return NULL on EOF (in which case we abort),
>> +        on error, or when the internal buffer has hit the size limit.
>> +        In the latter case return what we have read so far and signal
>> +        string truncation.
>>       */
>> -      if (!(length=fill_buffer(buffer)) || length == (uint) -1)
>> +      if (!(length=fill_buffer(buffer)))
> Coding style: add space after equal sign.
Done


Thread
bzr commit into mysql-5.1 branch (Dmitry.Shulga:3564) Bug#57450Dmitry Shulga20 Jan
  • Re: bzr commit into mysql-5.1 branch (Dmitry.Shulga:3564) Bug#57450Sergey Vojtovich21 Jan
    • Re: bzr commit into mysql-5.1 branch (Dmitry.Shulga:3564) Bug#57450Dmitry Shulga28 Jan
      • Re: bzr commit into mysql-5.1 branch (Dmitry.Shulga:3564) Bug#57450Sergey Vojtovich28 Jan