From 6f718e3669e9ecc1b1ca407a465d6ee20571a2b8 Mon Sep 17 00:00:00 2001 From: bapt Date: Sat, 19 Jul 2014 23:44:57 +0000 Subject: MFC: r263648, r264789, r266636 This brings: - schema validation - xpath-like interface for ucl objects Adapt pkg(7) to the new libucl API --- contrib/libucl/tests/test_basic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'contrib/libucl/tests/test_basic.c') diff --git a/contrib/libucl/tests/test_basic.c b/contrib/libucl/tests/test_basic.c index 641679f..5a977aa 100644 --- a/contrib/libucl/tests/test_basic.c +++ b/contrib/libucl/tests/test_basic.c @@ -21,10 +21,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include #include "ucl.h" +#include "ucl_internal.h" int main (int argc, char **argv) @@ -80,7 +78,9 @@ main (int argc, char **argv) while (!feof (in)) { memset (inbuf, 0, sizeof (inbuf)); - (void)fread (inbuf, sizeof (inbuf) - 1, 1, in); + if (fread (inbuf, 1, sizeof (inbuf) - 1, in) == 0) { + break; + } inlen = strlen (inbuf); test_in = malloc (inlen); memcpy (test_in, inbuf, inlen); @@ -97,7 +97,7 @@ main (int argc, char **argv) else { out = stdout; } - if (ucl_parser_get_error(parser) != NULL) { + if (ucl_parser_get_error (parser) != NULL) { fprintf (out, "Error occurred: %s\n", ucl_parser_get_error(parser)); ret = 1; goto end; @@ -112,7 +112,7 @@ main (int argc, char **argv) ucl_parser_free (parser); ucl_object_unref (obj); parser2 = ucl_parser_new (UCL_PARSER_KEY_LOWERCASE); - ucl_parser_add_chunk (parser2, emitted, strlen (emitted)); + ucl_parser_add_string (parser2, emitted, 0); if (ucl_parser_get_error(parser2) != NULL) { fprintf (out, "Error occurred: %s\n", ucl_parser_get_error(parser2)); -- cgit v1.1