libyang MAINTENANCE avoid string longer than 4096
diff --git a/tests/utests/basic/test_context.c b/tests/utests/basic/test_context.c
index 000c187..8fa8506 100644
--- a/tests/utests/basic/test_context.c
+++ b/tests/utests/basic/test_context.c
@@ -570,7 +570,8 @@
" </module>\n"
"</modules-state>";
- const char *with_netconf_features =
+ char *with_netconf_features = malloc(8096);
+ strcpy(with_netconf_features,
DATA_YANG_LIBRARY_START
" <module>\n"
" <name>ietf-netconf</name>\n"
@@ -609,7 +610,8 @@
" <name>ietf-netconf-acm</name>\n"
" <revision>2018-02-14</revision>\n"
" <namespace>urn:ietf:params:xml:ns:yang:ietf-netconf-acm</namespace>\n"
- " </import-only-module>\n"
+ " </import-only-module>\n");
+ strcpy(with_netconf_features + strlen(with_netconf_features),
DATA_YANG_SCHEMA_MODULE_STATE
" <module>\n"
" <name>ietf-netconf</name>\n"
@@ -631,7 +633,7 @@
" <namespace>urn:ietf:params:xml:ns:yang:ietf-netconf-acm</namespace>\n"
" <conformance-type>import</conformance-type>\n"
" </module>\n"
- "</modules-state>";
+ "</modules-state>");
const char *garbage_revision =
"<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">\n"
@@ -705,6 +707,7 @@
assert_int_equal(LY_SUCCESS, ly_ctx_new_ylmem(TESTS_SRC "/modules/yang/", no_yanglibrary, LYD_XML, LY_CTX_NO_YANGLIBRARY, &ctx_test));
assert_int_equal(NULL, ly_ctx_get_module(ctx_test, "ietf-yang-library", "2019-01-04"));
ly_ctx_destroy(ctx_test);
+ free(with_netconf_features);
}
static LY_ERR
diff --git a/tests/utests/data/test_diff.c b/tests/utests/data/test_diff.c
index 81850f8..7fee736 100644
--- a/tests/utests/data/test_diff.c
+++ b/tests/utests/data/test_diff.c
@@ -65,80 +65,80 @@
" yang-version 1.1;\n"
" namespace \"urn:libyang:tests:defaults\";\n"
" prefix df;\n"
- "\n"
+ ""
" feature unhide;\n"
- "\n"
+ ""
" typedef defint32 {\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" leaf hiddenleaf {\n"
" if-feature \"unhide\";\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" container df {\n"
" leaf foo {\n"
" type defint32;\n"
" }\n"
- "\n"
+ ""
" leaf hiddenleaf {\n"
" if-feature \"unhide\";\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" container bar {\n"
" presence \"\";\n"
" leaf hi {\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" leaf ho {\n"
" type int32;\n"
" mandatory true;\n"
" }\n"
" }\n"
- "\n"
+ ""
" leaf-list llist {\n"
" type defint32;\n"
" ordered-by user;\n"
" }\n"
- "\n"
+ ""
" list ul {\n"
" key \"l1\";\n"
" ordered-by user;\n"
" leaf l1 {\n"
" type string;\n"
" }\n"
- "\n"
+ ""
" leaf l2 {\n"
" type int32;\n"
" }\n"
" }\n"
- "\n"
+ ""
" leaf-list dllist {\n"
" type uint8;\n"
" default \"1\";\n"
" default \"2\";\n"
" default \"3\";\n"
" }\n"
- "\n"
+ ""
" list list {\n"
" key \"name\";\n"
" leaf name {\n"
" type string;\n"
" }\n"
- "\n"
+ ""
" leaf value {\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
" }\n"
- "\n"
+ ""
" choice select {\n"
" default \"a\";\n"
" case a {\n"
@@ -147,18 +147,18 @@
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" leaf a2 {\n"
" type int32;\n"
" default \"24\";\n"
" }\n"
" }\n"
" }\n"
- "\n"
+ ""
" leaf b {\n"
" type string;\n"
" }\n"
- "\n"
+ ""
" container c {\n"
" presence \"\";\n"
" leaf x {\n"
@@ -167,14 +167,14 @@
" }\n"
" }\n"
" }\n"
- "\n"
+ ""
" choice select2 {\n"
" default \"s2b\";\n"
" leaf s2a {\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" case s2b {\n"
" choice s2b {\n"
" default \"b1\";\n"
@@ -183,18 +183,18 @@
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" leaf b1_2 {\n"
" type string;\n"
" }\n"
- "\n"
+ ""
" leaf b1_status {\n"
" type int32;\n"
" default \"42\";\n"
" config false;\n"
" }\n"
" }\n"
- "\n"
+ ""
" leaf b2 {\n"
" type int32;\n"
" default \"42\";\n"
@@ -207,66 +207,66 @@
" leaf l1 {\n"
" type string;\n"
" }\n"
- "\n"
+ ""
" leaf l2 {\n"
" type int32;\n"
" }\n"
" }\n"
- "\n"
+ ""
" leaf-list kll {\n"
" config \"false\";\n"
" type string;\n"
" }\n"
" }\n"
- "\n"
+ ""
" container hidden {\n"
" leaf foo {\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" leaf baz {\n"
" type int32;\n"
" default \"42\";\n"
" }\n"
- "\n"
+ ""
" leaf papa {\n"
" type int32;\n"
" default \"42\";\n"
" config false;\n"
" }\n"
" }\n"
- "\n"
+ ""
" rpc rpc1 {\n"
" input {\n"
" leaf inleaf1 {\n"
" type string;\n"
" }\n"
- "\n"
+ ""
" leaf inleaf2 {\n"
" type string;\n"
" default \"def1\";\n"
" }\n"
" }\n"
- "\n"
+ ""
" output {\n"
" leaf outleaf1 {\n"
" type string;\n"
" default \"def2\";\n"
" }\n"
- "\n"
+ ""
" leaf outleaf2 {\n"
" type string;\n"
" }\n"
" }\n"
" }\n"
- "\n"
+ ""
" notification notif {\n"
" leaf ntfleaf1 {\n"
" type string;\n"
" default \"def3\";\n"
" }\n"
- "\n"
+ ""
" leaf ntfleaf2 {\n"
" type string;\n"
" }\n"
diff --git a/tests/utests/schema/test_printer_yin.c b/tests/utests/schema/test_printer_yin.c
index 5c610a7..02a24d3 100644
--- a/tests/utests/schema/test_printer_yin.c
+++ b/tests/utests/schema/test_printer_yin.c
@@ -25,7 +25,9 @@
{
struct lys_module *mod;
- const char *orig =
+ char *orig = malloc(8096);
+
+ strcpy(orig,
"module all {\n"
" yang-version 1.1;\n"
" namespace \"urn:all\";\n"
@@ -125,7 +127,8 @@
" }\n\n"
" leaf leaf10 {\n"
" type boolean;\n"
- " }\n\n"
+ " }\n\n");
+ strcpy(orig + strlen(orig),
" leaf leaf11 {\n"
" type enumeration {\n"
" enum \"one\";\n"
@@ -261,9 +264,11 @@
" in the #define.\";\n"
" argument \"name\";\n"
" }\n"
- "}\n";
+ "}\n");
- const char *ori_res =
+ char *ori_res = malloc(8096);
+
+ strcpy(ori_res,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<module name=\"all\"\n"
" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"\n"
@@ -380,7 +385,8 @@
" </choice>\n"
" <leaf name=\"leaf10\">\n"
" <type name=\"boolean\"/>\n"
- " </leaf>\n"
+ " </leaf>\n");
+ strcpy(ori_res + strlen(ori_res),
" <leaf name=\"leaf11\">\n"
" <type name=\"enumeration\">\n"
" <enum name=\"one\"/>\n"
@@ -509,7 +515,7 @@
" </container>\n"
" </output>\n"
" </rpc>\n"
- "</module>\n";
+ "</module>\n");
char *printed;
struct ly_out *out;
@@ -522,6 +528,8 @@
assert_string_equal(printed, ori_res);
ly_out_free(out, NULL, 1);
+ free(orig);
+ free(ori_res);
}
static LY_ERR