mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 17:14:30 +02:00
Merge siva.hindu.god:/usr/home/tim/m/bk/g51
into siva.hindu.god:/usr/home/tim/m/bk/tmp/mrg51-dec26 Makefile.am: Auto merged client/mysqlbinlog.cc: Auto merged configure.in: Auto merged client/mysqltest.c: Auto merged include/config-win.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/mysql.h: Auto merged include/typelib.h: Auto merged mysql-test/Makefile.am: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/r/type_timestamp.result: Auto merged mysql-test/r/warnings.result: Auto merged mysys/default.c: Auto merged mysys/my_wincond.c: Auto merged mysys/typelib.c: Auto merged server-tools/instance-manager/Makefile.am: Auto merged server-tools/instance-manager/guardian.cc: Auto merged server-tools/instance-manager/instance.cc: Auto merged sql/field.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/net_serv.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/share/charsets/hebrew.xml: Auto merged sql/sql_show.cc: Auto merged storage/federated/ha_federated.cc: Auto merged strings/conf_to_src.c: Auto merged vio/viossl.c: Auto merged sql/field.h: Manual merge sql/log_event.cc: Manual merge
This commit is contained in:
commit
6e84e11da5
76 changed files with 1229 additions and 1721 deletions
|
|
@ -118,3 +118,54 @@ const char *get_type(TYPELIB *typelib, uint nr)
|
|||
return(typelib->type_names[nr]);
|
||||
return "?";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Create a copy of a specified TYPELIB structure.
|
||||
|
||||
SYNOPSIS
|
||||
copy_typelib()
|
||||
root pointer to a MEM_ROOT object for allocations
|
||||
from pointer to a source TYPELIB structure
|
||||
|
||||
RETURN
|
||||
pointer to the new TYPELIB structure on successful copy, or
|
||||
NULL otherwise
|
||||
*/
|
||||
|
||||
TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from)
|
||||
{
|
||||
TYPELIB *to;
|
||||
uint i;
|
||||
|
||||
if (!from)
|
||||
return NULL;
|
||||
|
||||
if (!(to= (TYPELIB*) alloc_root(root, sizeof(TYPELIB))))
|
||||
return NULL;
|
||||
|
||||
if (!(to->type_names= (const char **)
|
||||
alloc_root(root, (sizeof(char *) + sizeof(int)) * (from->count + 1))))
|
||||
return NULL;
|
||||
to->type_lengths= (unsigned int *)(to->type_names + from->count + 1);
|
||||
to->count= from->count;
|
||||
if (from->name)
|
||||
{
|
||||
if (!(to->name= strdup_root(root, from->name)))
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
to->name= NULL;
|
||||
|
||||
for (i= 0; i < from->count; i++)
|
||||
{
|
||||
if (!(to->type_names[i]= strmake_root(root, from->type_names[i],
|
||||
from->type_lengths[i])))
|
||||
return NULL;
|
||||
to->type_lengths[i]= from->type_lengths[i];
|
||||
}
|
||||
to->type_names[to->count]= NULL;
|
||||
to->type_lengths[to->count]= 0;
|
||||
|
||||
return to;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue