diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 2f484d30ff76a20222309733de2efa1efdd166c3..199da9c4a84d9cc1ffb2ffe8808c506a4ee4c9dc 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -15,7 +15,3 @@ truncate table t1; load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); SELECT * from t1; drop table t1; - - - - diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index b273363aaf12aa76fa534d12a37d1c5c7ca13e3a..df9fe1f9bc4b9c34bd99232457adbb6b19205b8d 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -24,26 +24,26 @@ /* My memory allocator */ -gptr my_malloc(unsigned int Size, myf MyFlags) +gptr my_malloc(unsigned int size, myf my_flags) { gptr point; DBUG_ENTER("my_malloc"); - DBUG_PRINT("my",("Size: %u MyFlags: %d",Size, MyFlags)); + DBUG_PRINT("my",("size: %u my_flags: %d",size, my_flags)); - if (!Size) - Size=1; /* Safety */ - if ((point = (char*)malloc(Size)) == NULL) + if (!size) + size=1; /* Safety */ + if ((point = (char*)malloc(size)) == NULL) { my_errno=errno; - if (MyFlags & MY_FAE) + if (my_flags & MY_FAE) error_handler_hook=fatal_error_handler_hook; - if (MyFlags & (MY_FAE+MY_WME)) - my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size); - if (MyFlags & MY_FAE) + if (my_flags & (MY_FAE+MY_WME)) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size); + if (my_flags & MY_FAE) exit(1); } - else if (MyFlags & MY_ZEROFILL) - bzero(point,Size); + else if (my_flags & MY_ZEROFILL) + bzero(point,size); DBUG_PRINT("exit",("ptr: %lx",point)); DBUG_RETURN(point); } /* my_malloc */ @@ -64,29 +64,29 @@ void my_no_flags_free(gptr ptr) /* malloc and copy */ -gptr my_memdup(const byte *from, uint length, myf MyFlags) +gptr my_memdup(const byte *from, uint length, myf my_flags) { gptr ptr; - if ((ptr=my_malloc(length,MyFlags)) != 0) + if ((ptr=my_malloc(length,my_flags)) != 0) memcpy((byte*) ptr, (byte*) from,(size_t) length); return(ptr); } -char *my_strdup(const char *from, myf MyFlags) +char *my_strdup(const char *from, myf my_flags) { gptr ptr; uint length=(uint) strlen(from)+1; - if ((ptr=my_malloc(length,MyFlags)) != 0) + if ((ptr=my_malloc(length,my_flags)) != 0) memcpy((byte*) ptr, (byte*) from,(size_t) length); return((my_string) ptr); } -char *my_strdup_with_length(const byte *from, uint length, myf MyFlags) +char *my_strdup_with_length(const byte *from, uint length, myf my_flags) { gptr ptr; - if ((ptr=my_malloc(length+1,MyFlags)) != 0) + if ((ptr=my_malloc(length+1,my_flags)) != 0) { memcpy((byte*) ptr, (byte*) from,(size_t) length); ((char*) ptr)[length]=0; diff --git a/mysys/my_realloc.c b/mysys/my_realloc.c index 49d96c2eb4f43ea62ec678514201593483985dc3..5190fa75dce2d800e98c6cf5e6a2e3a1bf2d0c94 100644 --- a/mysys/my_realloc.c +++ b/mysys/my_realloc.c @@ -23,40 +23,41 @@ /* My memory re allocator */ -gptr my_realloc(gptr oldpoint, uint Size, myf MyFlags) +gptr my_realloc(gptr oldpoint, uint size, myf my_flags) { gptr point; DBUG_ENTER("my_realloc"); - DBUG_PRINT("my",("ptr: %lx Size: %u MyFlags: %d",oldpoint, Size, MyFlags)); + DBUG_PRINT("my",("ptr: %lx size: %u my_flags: %d",oldpoint, size, + my_flags)); - if (!oldpoint && (MyFlags & MY_ALLOW_ZERO_PTR)) - DBUG_RETURN(my_malloc(Size,MyFlags)); + if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR)) + DBUG_RETURN(my_malloc(size,my_flags)); #ifdef USE_HALLOC - if (!(point = malloc(Size))) + if (!(point = malloc(size))) { - if (MyFlags & MY_FREE_ON_ERROR) - my_free(oldpoint,MyFlags); - if (MyFlags & MY_HOLD_ON_ERROR) + if (my_flags & MY_FREE_ON_ERROR) + my_free(oldpoint,my_flags); + if (my_flags & MY_HOLD_ON_ERROR) DBUG_RETURN(oldpoint); my_errno=errno; - if (MyFlags & MY_FAE+MY_WME) - my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size); + if (my_flags & MY_FAE+MY_WME) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size); } else { - memcpy(point,oldpoint,Size); + memcpy(point,oldpoint,size); free(oldpoint); } #else - if ((point = (char*)realloc(oldpoint,Size)) == NULL) + if ((point = (char*)realloc(oldpoint,size)) == NULL) { - if (MyFlags & MY_FREE_ON_ERROR) + if (my_flags & MY_FREE_ON_ERROR) my_free(oldpoint,MyFLAGS); - if (MyFlags & MY_HOLD_ON_ERROR) + if (my_flags & MY_HOLD_ON_ERROR) DBUG_RETURN(oldpoint); my_errno=errno; - if (MyFlags & (MY_FAE+MY_WME)) - my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), Size); + if (my_flags & (MY_FAE+MY_WME)) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size); } #endif DBUG_PRINT("exit",("ptr: %lx",point)); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 539bb90d9074ad887b4915b2115d16fff63a36e5..b0d0565d2e309317d06dc50888e16084f2282a7c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4380,6 +4380,7 @@ keyword: | BOOL_SYM {} | BOOLEAN_SYM {} | BYTE_SYM {} + | BTREE_SYM {} | CACHE_SYM {} | CHANGED {} | CHARSET {} @@ -4425,6 +4426,7 @@ keyword: | GRANTS {} | GLOBAL_SYM {} | HANDLER_SYM {} + | HASH_SYM {} | HEAP_SYM {} | HELP_SYM {} | HOSTS_SYM {} @@ -4507,6 +4509,7 @@ keyword: | ROWS_SYM {} | ROW_FORMAT_SYM {} | ROW_SYM {} + | RTREE_SYM {} | SAVEPOINT_SYM {} | SECOND_SYM {} | SERIAL_SYM {} diff --git a/sql/table.cc b/sql/table.cc index 9d12de1f6c72a439037be696aee81ab400496ba7..a980e086d60798278a33338879605e58a9d31598 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1207,17 +1207,14 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res) char *get_field(MEM_ROOT *mem, Field *field) { - char buff[MAX_FIELD_WIDTH], *to; + char buff[MAX_FIELD_WIDTH]; String str(buff,sizeof(buff),&my_charset_bin); uint length; field->val_str(&str,&str); if (!(length= str.length())) return NullS; - to= (char*) alloc_root(mem,length+1); - memcpy(to, str.ptr(), (uint) length); - to[length]=0; - return to; + return strmake_root(mem, str.ptr(), length); }