6 #include "xmlrpc-c/base_int.h"
7 #include "xmlrpc-c/string_int.h"
11 nextLineSize(const char * const string,
12 size_t const startPos,
13 size_t const stringSize) {
14 /*----------------------------------------------------------------------------
15 Return the length of the line that starts at offset 'startPos' in the
16 string 'string', which is 'stringSize' characters long.
18 'string' in not NUL-terminated.
20 A line begins at beginning of string or after a newline character and
21 runs through the next newline character or end of string. The line
22 includes the newline character at the end, if any.
23 -----------------------------------------------------------------------------*/
26 for (i = startPos; i < stringSize && string[i] != '\n'; ++i);
29 ++i; /* Include the newline */
37 xmlrpc_traceXml(const char * const label,
39 unsigned int const xmlLength) {
41 if (getenv("XMLRPC_TRACE_XML")) {
42 size_t cursor; /* Index into xml[] */
44 fprintf(stderr, "%s:\n\n", label);
46 for (cursor = 0; cursor < xmlLength; ) {
47 /* Print one line of XML */
49 size_t const lineSize = nextLineSize(xml, cursor, xmlLength);
50 const char * const xmlPrintableLine =
51 xmlrpc_makePrintable_lp(&xml[cursor], lineSize);
53 fprintf(stderr, "%s\n", xmlPrintableLine);
57 xmlrpc_strfree(xmlPrintableLine);
59 fprintf(stderr, "\n");