~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/archive/archive_reader.c

  • Committer: Monty Taylor
  • Date: 2008-12-06 07:22:02 UTC
  • mto: (656.1.7 devel) (660.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: monty@inaugust.com-20081206072202-2g25o9doqr1l8euu
OOOh doggie. Got rid of my_alloca.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
      new_auto_increment_value= reader_handle.auto_increment + 1;
59
59
    }
60
60
 
61
 
    if (!(ret= azopen(&writer_handle, argv[0], O_CREAT|O_RDWR,
 
61
    if (!(ret= azopen(&writer_handle, argv[0], O_CREAT|O_RDWR, 
62
62
                      AZ_METHOD_BLOCK)))
63
63
    {
64
64
      printf("Could not open file for update: %s\n", argv[0]);
94
94
      char *comment =
95
95
        (char *) malloc(sizeof(char) * reader_handle.comment_length);
96
96
      azread_comment(&reader_handle, comment);
97
 
      printf("\tComment length %u\n\t\t%.*s\n", reader_handle.comment_length,
 
97
      printf("\tComment length %u\n\t\t%.*s\n", reader_handle.comment_length, 
98
98
             reader_handle.comment_length, comment);
99
99
      free(comment);
100
100
    }
160
160
    if (reader_handle.frm_length)
161
161
    {
162
162
      char *ptr;
163
 
      ptr= (char *)malloc(sizeof(char) * reader_handle.frm_length);
164
 
      if (ptr == NULL)
165
 
      {
166
 
        printf("Could not allocate enough memory\n");
167
 
        goto end;
168
 
      }
 
163
      ptr= (char *)my_malloc(sizeof(char) * reader_handle.frm_length, MYF(0));
169
164
      azread_frm(&reader_handle, ptr);
170
165
      azwrite_frm(&writer_handle, ptr, reader_handle.frm_length);
171
166
      free(ptr);
174
169
    if (reader_handle.comment_length)
175
170
    {
176
171
      char *ptr;
177
 
      ptr= (char *)malloc(sizeof(char) * reader_handle.comment_length);
 
172
      ptr= (char *)my_malloc(sizeof(char) * reader_handle.comment_length, MYF(0));
178
173
      azread_comment(&reader_handle, ptr);
179
174
      azwrite_comment(&writer_handle, ptr, reader_handle.comment_length);
180
175
      free(ptr);
210
205
    File frm_file;
211
206
    char *ptr;
212
207
    frm_file= my_open(argv[1], O_CREAT|O_RDWR, MYF(0));
213
 
    ptr= (char *)malloc(sizeof(char) * reader_handle.frm_length);
214
 
    if (ptr == NULL)
215
 
    {
216
 
      printf("Could not allocate enough memory\n");
217
 
      goto end;
218
 
    }
 
208
    ptr= (char *)my_malloc(sizeof(char) * reader_handle.frm_length, MYF(0));
219
209
    azread_frm(&reader_handle, ptr);
220
210
    my_write(frm_file, (unsigned char*) ptr, reader_handle.frm_length, MYF(0));
221
211
    my_close(frm_file, MYF(0));