From 0cfd37159a27802c8cc086dd182379bd4281c54b Mon Sep 17 00:00:00 2001 From: jbj Date: Mon, 14 Jun 2004 17:00:13 +0000 Subject: [PATCH] - xml: use markup for empty tags. CVS patchset: 7324 CVS date: 2004/06/14 17:00:13 --- CHANGES | 1 + lib/formats.c | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 109bd15..043e566 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ - add 'requires' and 'conflicts' tag aliases. - python: return ds, not tuple, for ds iteration. - python: permit integer keys to ts.dbMatch(). + - xml: use markup for empty tags. 4.3 -> 4.3.1: - fix: don't add leading space to %* argv expansion (#119059). diff --git a/lib/formats.c b/lib/formats.c index 5084d89..dd87842 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -350,12 +350,19 @@ static /*@only@*/ char * xmlFormat(int_32 type, const void * data, } /*@=branchstate@*/ - nb = 2 * strlen(xtag) + sizeof("\t<>") + xmlstrlen(s); - te = t = alloca(nb); - te = stpcpy( stpcpy( stpcpy(te, "\t<"), xtag), ">"); - te = xmlstrcpy(te, s); - te += strlen(te); - te = stpcpy( stpcpy( stpcpy(te, ""); + nb = xmlstrlen(s); + if (nb == 0) { + nb += strlen(xtag) + sizeof("\t"); + te = t = alloca(nb); + te = stpcpy( stpcpy( stpcpy(te, "\t<"), xtag), "/>"); + } else { + nb += 2 * strlen(xtag) + sizeof("\t<>"); + te = t = alloca(nb); + te = stpcpy( stpcpy( stpcpy(te, "\t<"), xtag), ">"); + te = xmlstrcpy(te, s); + te += strlen(te); + te = stpcpy( stpcpy( stpcpy(te, ""); + } /* XXX s was malloc'd */ /*@-branchstate@*/ -- 2.7.4