~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/readline.cc

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* readline for batch mode */
17
17
 
18
 
#include <drizzled/global.h>
 
18
#include "client_priv.h"
19
19
#include <mysys/my_sys.h>
20
20
#include <mystrings/m_string.h>
21
21
#include "my_readline.h"
22
22
 
23
 
using namespace std;
24
 
 
25
23
static bool init_line_buffer(LINE_BUFFER *buffer,File file,uint32_t size,
26
24
                            uint32_t max_size);
27
25
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str);
37
35
    return 0;
38
36
  if (init_line_buffer(line_buff,fileno(file),IO_SIZE,max_size))
39
37
  {
40
 
    free(line_buff);
 
38
    my_free(line_buff,MYF(0));
41
39
    return 0;
42
40
  }
43
41
  return line_buff;
64
62
{
65
63
  if (line_buff)
66
64
  {
67
 
    free(line_buff->buffer);
68
 
    free(line_buff);
 
65
    my_free(line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR));
 
66
    my_free(line_buff,MYF(0));
69
67
  }
70
68
}
71
69
 
78
76
      return 0;
79
77
  if (init_line_buffer_from_string(line_buff,str))
80
78
  {
81
 
    free(line_buff);
 
79
    my_free(line_buff,MYF(0));
82
80
    return 0;
83
81
  }
84
82
  return line_buff;
113
111
  uint old_length=(uint)(buffer->end - buffer->buffer);
114
112
  uint length= (uint) strlen(str);
115
113
  if (!(buffer->buffer= buffer->start_of_line= buffer->end_of_line=
116
 
        (char*) my_realloc((unsigned char*) buffer->buffer, old_length+length+2,
 
114
        (char*) my_realloc((uchar*) buffer->buffer, old_length+length+2,
117
115
                           MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
118
116
    return 1;
119
117
  buffer->end= buffer->buffer + old_length;
168
166
  }
169
167
 
170
168
  /* Read in new stuff. */
171
 
  if ((read_count= my_read(buffer->file, (unsigned char*) buffer->end, read_count,
 
169
  if ((read_count= my_read(buffer->file, (uchar*) buffer->end, read_count,
172
170
                           MYF(MY_WME))) == MY_FILE_ERROR)
173
171
    return (size_t) -1;
174
172