MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / xode_insert_cdata

Function xode_insert_cdata

modules/xmpp/xode.c:290–319  ·  view source on GitHub ↗

* xode_insert_cdata -- append character data to a tag * If last child of the parent is CDATA, merges CDATA nodes. Otherwise * creates a CDATA node, and appends it to the parent's child list. * * parameters * parent -- parent tag * CDATA -- character data * size -- size of CDATA * or -1 for null-terminated CDATA strings * * returns * a pointer to the

Source from the content-addressed store, hash-verified

288 * or NULL if it was unsuccessful
289 */
290xode xode_insert_cdata(xode parent, const char* CDATA, unsigned int size)
291{
292 xode result;
293
294 if(CDATA == NULL || parent == NULL)
295 return NULL;
296
297 if(size == -1)
298 size = strlen(CDATA);
299
300 if ((parent->lastchild != NULL) && (parent->lastchild->type == XODE_TYPE_CDATA))
301 {
302 result = parent->lastchild;
303 result->data = _xode_merge(result->p, result->data, result->data_sz, CDATA, size);
304 result->data_sz = result->data_sz + size;
305 }
306 else
307 {
308 result = _xode_insert(parent, "", XODE_TYPE_CDATA);
309 if (result != NULL)
310 {
311 result->data = (char*)xode_pool_malloc(result->p, size + 1);
312 memcpy(result->data, CDATA, size);
313 result->data[size] = '\0';
314 result->data_sz = size;
315 }
316 }
317
318 return result;
319}
320
321
322/*

Callers 9

_xode_expat_charDataFunction · 0.70
stream_node_callbackFunction · 0.70
_xode_stream_charDataFunction · 0.70
xode_stream_eatFunction · 0.70
out_stream_node_callbackFunction · 0.70
in_stream_node_callbackFunction · 0.70
do_send_message_serverFunction · 0.70
xode_insert_nodeFunction · 0.70

Calls 3

_xode_mergeFunction · 0.70
_xode_insertFunction · 0.70
xode_pool_mallocFunction · 0.70

Tested by

no test coverage detected