~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

  • Committer: Monty Taylor
  • Date: 2009-05-18 21:20:04 UTC
  • mto: (1022.2.34 mordred)
  • mto: This revision was merged to the branch mainline in revision 1039.
  • Revision ID: mordred@inaugust.com-20090518212004-y3uaujfzt8i64pq7
Replaced a malloc with a calloc. Resisted the urge to rewrite/replace the entire class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
class READ_INFO {
28
28
  File  file;
29
 
  unsigned char *buffer,                        /* Buffer for read text */
30
 
        *end_of_buff;                   /* Data in bufferts ends here */
31
 
  uint  buff_length,                    /* Length of buffert */
32
 
        max_length;                     /* Max length of row */
 
29
  unsigned char *buffer;                /* Buffer for read text */
 
30
  unsigned char *end_of_buff;           /* Data in bufferts ends here */
 
31
  size_t buff_length;                   /* Length of buffert */
 
32
  size_t max_length;                    /* Max length of row */
33
33
  char  *field_term_ptr,*line_term_ptr,*line_start_ptr,*line_start_end;
34
34
  uint  field_term_length,line_term_length,enclosed_length;
35
35
  int   field_term_char,line_term_char,enclosed_char,escape_char;
44
44
        *row_end;                       /* Found row ends here */
45
45
  const CHARSET_INFO *read_charset;
46
46
 
47
 
  READ_INFO(File file,uint32_t tot_length, const CHARSET_INFO * const cs,
 
47
  READ_INFO(File file, size_t tot_length, const CHARSET_INFO * const cs,
48
48
            String &field_term,String &line_start,String &line_term,
49
49
            String &enclosed,int escape, bool is_fifo);
50
50
  ~READ_INFO();
203
203
 
204
204
  table->mark_columns_needed_for_insert();
205
205
 
206
 
  uint32_t tot_length=0;
 
206
  size_t tot_length=0;
207
207
  bool use_blobs= 0, use_vars= 0;
208
208
  List_iterator_fast<Item> it(fields_vars);
209
209
  Item *item;
294
294
  info.handle_duplicates=handle_duplicates;
295
295
  info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
296
296
 
297
 
  READ_INFO read_info(file,tot_length,
 
297
  READ_INFO read_info(file, tot_length,
298
298
                      ex->cs ? ex->cs : session->variables.collation_database,
299
299
                      *field_term,*ex->line_start, *ex->line_term, *enclosed,
300
300
                      info.escape_char, is_fifo);
720
720
*/
721
721
 
722
722
 
723
 
READ_INFO::READ_INFO(File file_par, uint32_t tot_length, const CHARSET_INFO * const cs,
 
723
READ_INFO::READ_INFO(File file_par, size_t tot_length,
 
724
                     const CHARSET_INFO * const cs,
724
725
                     String &field_term, String &line_start, String &line_term,
725
726
                     String &enclosed_par, int escape, bool is_fifo)
726
727
  :file(file_par),escape_char(escape)
761
762
  set_if_bigger(length,line_start.length());
762
763
  stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
763
764
 
764
 
  if (!(buffer=(unsigned char*) malloc(buff_length+1)))
 
765
  if (!(buffer=(unsigned char*) calloc(1, buff_length+1)))
765
766
    error=1; /* purecov: inspected */
766
767
  else
767
768
  {
793
794
  {
794
795
    if (need_end_io_cache)
795
796
      ::end_io_cache(&cache);
796
 
    free((unsigned char*) buffer);
 
797
    free(buffer);
797
798
    error=1;
798
799
  }
799
800
}