int
copy_ChopstixItemStyle(const ChopstixItemStyle *from, ChopstixItemStyle *to)
{
*(&(to)->num) = *(&(from)->num);
if(copy_general_string(&(from)->name, &(to)->name)) return ENOMEM;
return 0;
}
int
copy_PrincipalName(const PrincipalName *from, PrincipalName *to)
{
if(copy_NAME_TYPE(&(from)->name_type, &(to)->name_type)) return ENOMEM;
if(((&(to)->name_string)->val = malloc((&(from)->name_string)->len * sizeof(*(&(to)->name_string)->val))) == NULL && (&(from)->name_string)->len != 0)
return ENOMEM;
for((&(to)->name_string)->len = 0; (&(to)->name_string)->len < (&(from)->name_string)->len; (&(to)->name_string)->len++){
if(copy_general_string(&(&(from)->name_string)->val[(&(to)->name_string)->len], &(&(to)->name_string)->val[(&(to)->name_string)->len])) return ENOMEM;
}
return 0;
}
int
copy_ChopstixMenuitem(const ChopstixMenuitem *from, ChopstixMenuitem *to)
{
*(&(to)->gen) = *(&(from)->gen);
if(copy_ChopstixItemCode(&(from)->code, &(to)->code)) return ENOMEM;
if(copy_general_string(&(from)->name, &(to)->name)) return ENOMEM;
*(&(to)->price) = *(&(from)->price);
if(copy_ChopstixItemStyles(&(from)->styles, &(to)->styles)) return ENOMEM;
if(copy_ChopstixItemExtras(&(from)->extras, &(to)->extras)) return ENOMEM;
if((from)->subitems) {
(to)->subitems = malloc(sizeof(*(to)->subitems));
if((to)->subitems == NULL) return ENOMEM;
if(copy_ChopstixItemExtras((from)->subitems, (to)->subitems)) return ENOMEM;
}else
(to)->subitems = NULL;
if(copy_ChopstixFlags(&(from)->flags, &(to)->flags)) return ENOMEM;
return 0;
}
int
copy_ChopstixCreditNumber(const ChopstixCreditNumber *from, ChopstixCreditNumber *to)
{
if(copy_general_string(from, to)) return ENOMEM;
return 0;
}
int
copy_ChopstixIntersect(const ChopstixIntersect *from, ChopstixIntersect *to)
{
if(copy_general_string(&(from)->cross, &(to)->cross)) return ENOMEM;
return 0;
}
int
copy_ChopstixName(const ChopstixName *from, ChopstixName *to)
{
if(copy_general_string(from, to)) return ENOMEM;
return 0;
}
Example #7
0
int
copy_Realm(const Realm *from, Realm *to)
{
if(copy_general_string(from, to)) return ENOMEM;
return 0;
}