Commit c0cea540 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into narttu.mysql.fi:/my/mysql-4.1


sql/sql_yacc.yy:
  Auto merged
parents 3b799e8f c01d65bc
...@@ -15,7 +15,3 @@ truncate table t1; ...@@ -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); load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
SELECT * from t1; SELECT * from t1;
drop table t1; drop table t1;
...@@ -24,26 +24,26 @@ ...@@ -24,26 +24,26 @@
/* My memory allocator */ /* My memory allocator */
gptr my_malloc(unsigned int Size, myf MyFlags) gptr my_malloc(unsigned int size, myf my_flags)
{ {
gptr point; gptr point;
DBUG_ENTER("my_malloc"); 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) if (!size)
Size=1; /* Safety */ size=1; /* Safety */
if ((point = (char*)malloc(Size)) == NULL) if ((point = (char*)malloc(size)) == NULL)
{ {
my_errno=errno; my_errno=errno;
if (MyFlags & MY_FAE) if (my_flags & MY_FAE)
error_handler_hook=fatal_error_handler_hook; error_handler_hook=fatal_error_handler_hook;
if (MyFlags & (MY_FAE+MY_WME)) if (my_flags & (MY_FAE+MY_WME))
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size); my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
if (MyFlags & MY_FAE) if (my_flags & MY_FAE)
exit(1); exit(1);
} }
else if (MyFlags & MY_ZEROFILL) else if (my_flags & MY_ZEROFILL)
bzero(point,Size); bzero(point,size);
DBUG_PRINT("exit",("ptr: %lx",point)); DBUG_PRINT("exit",("ptr: %lx",point));
DBUG_RETURN(point); DBUG_RETURN(point);
} /* my_malloc */ } /* my_malloc */
...@@ -64,29 +64,29 @@ void my_no_flags_free(gptr ptr) ...@@ -64,29 +64,29 @@ void my_no_flags_free(gptr ptr)
/* malloc and copy */ /* 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; 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); memcpy((byte*) ptr, (byte*) from,(size_t) length);
return(ptr); return(ptr);
} }
char *my_strdup(const char *from, myf MyFlags) char *my_strdup(const char *from, myf my_flags)
{ {
gptr ptr; gptr ptr;
uint length=(uint) strlen(from)+1; 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); memcpy((byte*) ptr, (byte*) from,(size_t) length);
return((my_string) ptr); 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; 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); memcpy((byte*) ptr, (byte*) from,(size_t) length);
((char*) ptr)[length]=0; ((char*) ptr)[length]=0;
......
...@@ -23,40 +23,41 @@ ...@@ -23,40 +23,41 @@
/* My memory re allocator */ /* 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; gptr point;
DBUG_ENTER("my_realloc"); 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)) if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
DBUG_RETURN(my_malloc(Size,MyFlags)); DBUG_RETURN(my_malloc(size,my_flags));
#ifdef USE_HALLOC #ifdef USE_HALLOC
if (!(point = malloc(Size))) if (!(point = malloc(size)))
{ {
if (MyFlags & MY_FREE_ON_ERROR) if (my_flags & MY_FREE_ON_ERROR)
my_free(oldpoint,MyFlags); my_free(oldpoint,my_flags);
if (MyFlags & MY_HOLD_ON_ERROR) if (my_flags & MY_HOLD_ON_ERROR)
DBUG_RETURN(oldpoint); DBUG_RETURN(oldpoint);
my_errno=errno; my_errno=errno;
if (MyFlags & MY_FAE+MY_WME) if (my_flags & MY_FAE+MY_WME)
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size); my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
} }
else else
{ {
memcpy(point,oldpoint,Size); memcpy(point,oldpoint,size);
free(oldpoint); free(oldpoint);
} }
#else #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); my_free(oldpoint,MyFLAGS);
if (MyFlags & MY_HOLD_ON_ERROR) if (my_flags & MY_HOLD_ON_ERROR)
DBUG_RETURN(oldpoint); DBUG_RETURN(oldpoint);
my_errno=errno; my_errno=errno;
if (MyFlags & (MY_FAE+MY_WME)) if (my_flags & (MY_FAE+MY_WME))
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), Size); my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
} }
#endif #endif
DBUG_PRINT("exit",("ptr: %lx",point)); DBUG_PRINT("exit",("ptr: %lx",point));
......
...@@ -4380,6 +4380,7 @@ keyword: ...@@ -4380,6 +4380,7 @@ keyword:
| BOOL_SYM {} | BOOL_SYM {}
| BOOLEAN_SYM {} | BOOLEAN_SYM {}
| BYTE_SYM {} | BYTE_SYM {}
| BTREE_SYM {}
| CACHE_SYM {} | CACHE_SYM {}
| CHANGED {} | CHANGED {}
| CHARSET {} | CHARSET {}
...@@ -4425,6 +4426,7 @@ keyword: ...@@ -4425,6 +4426,7 @@ keyword:
| GRANTS {} | GRANTS {}
| GLOBAL_SYM {} | GLOBAL_SYM {}
| HANDLER_SYM {} | HANDLER_SYM {}
| HASH_SYM {}
| HEAP_SYM {} | HEAP_SYM {}
| HELP_SYM {} | HELP_SYM {}
| HOSTS_SYM {} | HOSTS_SYM {}
...@@ -4507,6 +4509,7 @@ keyword: ...@@ -4507,6 +4509,7 @@ keyword:
| ROWS_SYM {} | ROWS_SYM {}
| ROW_FORMAT_SYM {} | ROW_FORMAT_SYM {}
| ROW_SYM {} | ROW_SYM {}
| RTREE_SYM {}
| SAVEPOINT_SYM {} | SAVEPOINT_SYM {}
| SECOND_SYM {} | SECOND_SYM {}
| SERIAL_SYM {} | SERIAL_SYM {}
......
...@@ -1207,17 +1207,14 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res) ...@@ -1207,17 +1207,14 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res)
char *get_field(MEM_ROOT *mem, Field *field) 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); String str(buff,sizeof(buff),&my_charset_bin);
uint length; uint length;
field->val_str(&str,&str); field->val_str(&str,&str);
if (!(length= str.length())) if (!(length= str.length()))
return NullS; return NullS;
to= (char*) alloc_root(mem,length+1); return strmake_root(mem, str.ptr(), length);
memcpy(to, str.ptr(), (uint) length);
to[length]=0;
return to;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment