[Refdb-devel] CVS: refdb/src xmlhelper.c,1.1,1.2 xmlhelper.h,1.1,1.2
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2003-12-21 23:15:13
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1:/tmp/cvs-serv2202/src Modified Files: xmlhelper.c xmlhelper.h Log Message: added support for fourth attribute to print_elstart_x() Index: xmlhelper.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/xmlhelper.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -U2 -r1.1 -r1.2 --- xmlhelper.c 18 Oct 2003 23:30:34 -0000 1.1 +++ xmlhelper.c 21 Dec 2003 23:15:07 -0000 1.2 @@ -72,5 +72,5 @@ } - if ((new_ref = print_elstart_x(ptr_buffer, ptr_buflen, elname, attname, attvalue, NULL, NULL, NULL, NULL, is_empty, ptr_indent)) == NULL) { + if ((new_ref = print_elstart_x(ptr_buffer, ptr_buflen, elname, attname, attvalue, NULL, NULL, NULL, NULL, NULL, NULL, is_empty, ptr_indent)) == NULL) { LOG_PRINT(LOG_WARNING, outomem.text); return NULL; @@ -122,7 +122,11 @@ const char* attvalue1 value of 2nd attribute, if any - const char* attname2 name of 2nd attribute, if any + const char* attname2 name of 3rd attribute, if any - const char* attvalue2 value of 2nd attribute, if any + const char* attvalue2 value of 3rd attribute, if any + + const char* attname3 name of 4th attribute, if any + + const char* attvalue3 value of 4th attribute, if any int is_empty if non-zero, element is assumed to be empty @@ -131,5 +135,5 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -char* print_elstart_x(char** ptr_buffer, size_t* ptr_buflen, const char* elname, const char* attname, const char* attvalue, const char* attname1, const char* attvalue1, const char* attname2, const char* attvalue2, int is_empty, struct xmlindent* ptr_indent) { +char* print_elstart_x(char** ptr_buffer, size_t* ptr_buflen, const char* elname, const char* attname, const char* attvalue, const char* attname1, const char* attvalue1, const char* attname2, const char* attvalue2, const char* attname3, const char* attvalue3, int is_empty, struct xmlindent* ptr_indent) { /* ToDo: The attname/attname1 thing is pretty much like cheating. This could be done in a cleaner way using an attribute @@ -228,4 +232,10 @@ } /* end if attname */ + if (attname3 && *attname3) { + if (!print_attribute_x(ptr_buffer, ptr_buflen, attname3, attvalue3)) { + return NULL; + } + } /* end if attname */ + if (is_empty) { ptr_indent->maybe_in_leaf = 0; @@ -270,4 +280,9 @@ char* print_attribute_x(char** ptr_buffer, size_t* ptr_buflen, const char* attname, const char* attvalue) { char* new_ref; + + if (!attname || !*attname || !attvalue || !*attvalue) { + /* nothing to do */ + return *ptr_buffer; + } /* need to print a space, the attribute name, a '=', the Index: xmlhelper.h =================================================================== RCS file: /cvsroot/refdb/refdb/src/xmlhelper.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -U2 -r1.1 -r1.2 --- xmlhelper.h 18 Oct 2003 23:30:34 -0000 1.1 +++ xmlhelper.h 21 Dec 2003 23:15:07 -0000 1.2 @@ -36,5 +36,5 @@ char* print_element_x(const char* elvalue, char** ptr_buffer, size_t* ptr_buflen, const char* elname, const char* attname, const char* attvalue, struct xmlindent* ptr_indent); -char* print_elstart_x(char** ptr_buffer, size_t* ptr_buflen, const char* elname, const char* attname, const char* attvalue, const char* attname1, const char* attvalue1, const char* attname2, const char* attvalue2, int is_empty, struct xmlindent* ptr_indent); +char* print_elstart_x(char** ptr_buffer, size_t* ptr_buflen, const char* elname, const char* attname, const char* attvalue, const char* attname1, const char* attvalue1, const char* attname2, const char* attvalue2, const char* attname3, const char* attvalue3, int is_empty, struct xmlindent* ptr_indent); char* print_elend_x(char** ptr_buffer, size_t* ptr_buflen, const char* elname, struct xmlindent* ptr_indent); char* print_attribute_x(char** ptr_buffer, size_t* ptr_buflen, const char* attname, const char* attvalue); |