00001 /* 00002 * This file is part of liberscribble. 00003 * 00004 * liberscribble is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * liberscribble is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00023 #include "scbxml.h" 00024 #include "scblog.h" 00025 #include <glib.h> 00026 00027 ScbXmlPtr scb_xml_clone(const ScbXmlPtr src) 00028 { 00029 if (NULL == src) 00030 { 00031 SCB_ERROR("Invalid src pointer!"); 00032 return NULL; 00033 } 00034 00035 ScbXmlPtr ret = g_new0(ScbXml, 1); 00036 if (NULL == ret) 00037 { 00038 SCB_ERROR("Not enough memory!"); 00039 return NULL; 00040 } 00041 // add ref 00042 ret->handle.pDoc = src->handle.pDoc; 00043 ret->handle.pPathCtx = src->handle.pPathCtx; 00044 strncpy(ret->xPath, src->xPath, SCB_MAX_XML_PATH); 00045 ret->index = src->index; 00046 return ret; 00047 } 00048 00049 void scb_xml_free(ScbXmlPtr ptr) 00050 { 00051 g_free(ptr); 00052 }
1.5.6