From 1683723b1dd38e27b0b82f4a2abef09ca4c74beb Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 7 Nov 2022 10:07:10 +0100 Subject: [PATCH] Removed `JSON_CDATA_STRIP` compile-time option (obsolete since 5.4) --- CHANGELOG.md | 1 + include/clixon_custom.h | 11 ----------- lib/src/clixon_json.c | 23 ----------------------- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23188c94..bd0026b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ Developers may need to change their code ### Minor features +* Removed `JSON_CDATA_STRIP` compile-time option (obsolete since 5.4) * Added fuzz code for xpath * List-pagination: Follow ietf-draft 100%: Removed list-pagination "presence" * Main example: Removed dependency of external IETF RFCs diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 1f3e1b27..6079f68c 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -127,17 +127,6 @@ */ #undef LIST_PAGINATION_REMAINING -/*! XML CDATA encoding in payload is stripped when translating to JSON - * Example: XML: " x & x < y ]]>" is translated to - * JSON: {"s":" z > x & x < y "} - * If not set: - * JSON: {"s":" x & x < y ]]>"}` - * Clixon stripped CDATA in 5.3 and earlier versions. - * To keep this backward-compatible enable this option - * Consider removing this option after 5.4 - */ -#undef JSON_CDATA_STRIP - /*! * RFC 7950 generally does not specify an XML/JSON encoding order of sub-elements of list or * containers. See sections 7.5.7 and 7.8.5 diff --git a/lib/src/clixon_json.c b/lib/src/clixon_json.c index d2b7c106..bdc57e32 100644 --- a/lib/src/clixon_json.c +++ b/lib/src/clixon_json.c @@ -251,9 +251,6 @@ json_str_escape_cdata(cbuf *cb, int retval = -1; int i; size_t len; -#ifdef JSON_CDATA_STRIP - int esc = 0; /* cdata escape */ -#endif len = strlen(str); for (i=0; i", strlen("]]>")) == 0){ - esc=0; - i += strlen("]]>")-1; - } - else - cprintf(cb, "%c", str[i]); - break; -#endif /* JSON_CDATA_STRIP */ default: /* fall thru */ cprintf(cb, "%c", str[i]); break;