~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • 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:
36
36
#include <drizzled/sql_load.h>
37
37
#include <drizzled/field/timestamp.h>
38
38
 
39
 
/* Define to force use of malloc() if the allocated memory block is big */
40
 
 
41
 
#ifndef HAVE_ALLOCA
42
 
#define my_safe_alloca(size, min_length) my_alloca(size)
43
 
#define my_safe_afree(ptr, size, min_length) my_afree(ptr)
44
 
#else
45
 
#define my_safe_alloca(size, min_length) ((size <= min_length) ? my_alloca(size) : malloc(size))
46
 
#define my_safe_afree(ptr, size, min_length) if (size > min_length) free(ptr)
47
 
#endif
48
 
 
49
 
 
50
39
 
51
40
/*
52
41
  Check if insert fields are correct.
873
862
 
874
863
        if (!key)
875
864
        {
876
 
          if (!(key=(char*) my_safe_alloca(table->s->max_unique_length,
877
 
                                           MAX_KEY_LENGTH)))
 
865
          if (!(key=(char*) malloc(table->s->max_unique_length)))
878
866
          {
879
867
            error=ENOMEM;
880
868
            goto err;
1017
1005
 
1018
1006
gok_or_after_err:
1019
1007
  if (key)
1020
 
    my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
 
1008
    free(key);
1021
1009
  if (!table->file->has_transactions())
1022
1010
    session->transaction.stmt.modified_non_trans_table= true;
1023
1011
  return(0);
1032
1020
before_err:
1033
1021
  table->file->restore_auto_increment(prev_insert_id);
1034
1022
  if (key)
1035
 
    my_safe_afree(key, table->s->max_unique_length, MAX_KEY_LENGTH);
 
1023
    free(key);
1036
1024
  table->column_bitmaps_set(save_read_set, save_write_set);
1037
1025
  return(1);
1038
1026
}