Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Sync libucl
Baptiste Daroussin committed 12 years ago
commit 23189c927385161de41f1aa6ffbdb52b6d9b566f
parent bdc8223
5 files changed +26 -22
modified external/libucl/src/ucl_emitter.c
@@ -141,7 +141,7 @@ ucl_print_float (UT_string *buf, double val)
static void
ucl_elt_obj_write_json (ucl_object_t *obj, UT_string *buf, unsigned int tabs, bool start_tabs, bool compact)
{
-
	ucl_object_t *cur, *tmp;
+
	ucl_object_t *cur;
	ucl_hash_iter_t it = NULL;

	if (start_tabs) {
@@ -168,19 +168,18 @@ ucl_elt_obj_write_json (ucl_object_t *obj, UT_string *buf, unsigned int tabs, bo
			utstring_append_len (buf, ": ", 2);
		}
		ucl_obj_write_json (cur, buf, tabs + 1, false, compact);
-
		if (compact) {
-
			utstring_append_c (buf, ',');
+
		if (ucl_hash_iter_has_next (it)) {
+
			if (compact) {
+
				utstring_append_c (buf, ',');
+
			}
+
			else {
+
				utstring_append_len (buf, ",\n", 2);
+
			}
		}
-
		else {
-
			utstring_append_len (buf, ",\n", 2);
+
		else if (!compact) {
+
			utstring_append_c (buf, '\n');
		}
	}
-
	buf->i--;
-
	if (!compact) {
-
		buf->i--;
-
		utstring_append_c(buf, '\n');
-
	}
-

	ucl_add_tabs (buf, tabs, compact);
	utstring_append_c (buf, '}');
}
@@ -480,7 +479,7 @@ ucl_object_emit_rcl (ucl_object_t *obj)
static void
ucl_elt_obj_write_yaml (ucl_object_t *obj, UT_string *buf, unsigned int tabs, bool start_tabs, bool is_top)
{
-
	ucl_object_t *cur, *tmp;
+
	ucl_object_t *cur;
	ucl_hash_iter_t it = NULL;

	if (start_tabs) {
modified external/libucl/src/ucl_hash.c
@@ -87,7 +87,7 @@ ucl_hash_iter_has_next (ucl_hash_iter_t iter)
{
	ucl_hash_node_t *elt = iter;

-
	return (elt != NULL && elt->hh.next != NULL);
+
	return (elt == NULL || elt->hh.prev != NULL);
}


modified external/libucl/src/ucl_util.c
@@ -43,7 +43,6 @@ static void
ucl_object_free_internal (ucl_object_t *obj, bool allow_rec)
{
	ucl_object_t *sub, *tmp;
-
	ucl_hash_iter_t it = NULL;

	while (obj != NULL) {
		if (obj->trash_stack[UCL_TRASH_KEY] != NULL) {
@@ -62,7 +61,9 @@ ucl_object_free_internal (ucl_object_t *obj, bool allow_rec)
			}
		}
		else if (obj->type == UCL_OBJECT) {
-
			ucl_hash_destroy (obj->value.ov, (ucl_hash_free_func *)ucl_obj_free);
+
			if (obj->value.ov != NULL) {
+
				ucl_hash_destroy (obj->value.ov, (ucl_hash_free_func *)ucl_obj_free);
+
			}
		}
		tmp = obj->next;
		UCL_FREE (sizeof (ucl_object_t), obj);
@@ -276,7 +277,6 @@ ucl_parser_get_error(struct ucl_parser *parser)
bool
ucl_pubkey_add (struct ucl_parser *parser, const unsigned char *key, size_t len)
{
-
	struct ucl_pubkey *nkey;
#ifndef HAVE_OPENSSL
	ucl_create_err (&parser->err, "cannot check signatures without openssl");
	return false;
@@ -285,6 +285,7 @@ ucl_pubkey_add (struct ucl_parser *parser, const unsigned char *key, size_t len)
	ucl_create_err (err, "cannot check signatures, openssl version is unsupported");
	return EXIT_FAILURE;
# else
+
	struct ucl_pubkey *nkey;
	BIO *mem;

	mem = BIO_new_mem_buf ((void *)key, len);
@@ -517,8 +518,8 @@ ucl_include_url (const unsigned char *data, size_t len,
{

	bool res;
-
	unsigned char *buf = NULL, *sigbuf = NULL;
-
	size_t buflen = 0, siglen = 0;
+
	unsigned char *buf = NULL;
+
	size_t buflen = 0;
	struct ucl_chunk *chunk;
	char urlbuf[PATH_MAX];

@@ -530,6 +531,8 @@ ucl_include_url (const unsigned char *data, size_t len,

	if (check_signature) {
#if (defined(HAVE_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10000000L)
+
		unsigned char *sigbuf = NULL;
+
		size_t siglen = 0;
		/* We need to check signature first */
		snprintf (urlbuf, sizeof (urlbuf), "%.*s.sig", (int)len, data);
		if (!ucl_fetch_file (urlbuf, &sigbuf, &siglen, &parser->err)) {
@@ -574,8 +577,8 @@ ucl_include_file (const unsigned char *data, size_t len,
{
	bool res;
	struct ucl_chunk *chunk;
-
	unsigned char *buf = NULL, *sigbuf = NULL;
-
	size_t buflen, siglen;
+
	unsigned char *buf = NULL;
+
	size_t buflen;
	char filebuf[PATH_MAX], realbuf[PATH_MAX];

	snprintf (filebuf, sizeof (filebuf), "%.*s", (int)len, data);
@@ -592,6 +595,8 @@ ucl_include_file (const unsigned char *data, size_t len,

	if (check_signature) {
#if (defined(HAVE_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10000000L)
+
		unsigned char *sigbuf = NULL;
+
		size_t siglen = 0;
		/* We need to check signature first */
		snprintf (filebuf, sizeof (filebuf), "%s.sig", realbuf);
		if (!ucl_fetch_file (filebuf, &sigbuf, &siglen, &parser->err)) {
modified external/libucl/src/xxhash.c
@@ -307,7 +307,7 @@ struct XXH_state32_t
};


-
int XXH32_sizeofState() 
+
int XXH32_sizeofState(void)
{
    XXH_STATIC_ASSERT(XXH32_SIZEOFSTATE >= sizeof(struct XXH_state32_t));   // A compilation error here means XXH32_SIZEOFSTATE is not large enough
    return sizeof(struct XXH_state32_t); 
modified external/libucl/src/xxhash.h
@@ -121,7 +121,7 @@ Memory will be freed by XXH32_digest().
*/


-
int           XXH32_sizeofState();
+
int           XXH32_sizeofState(void);
XXH_errorcode XXH32_resetState(void* state, unsigned int seed);

#define       XXH32_SIZEOFSTATE 48