From 5510dea9bae529885a1a5a0afa042e43e7ef1104 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 14 May 2018 19:00:16 +0300 Subject: [PATCH] cn_cbor_decode: set errp with CN_CBOR_NO_ERROR on success for consistency, both > if (errp->err == CN_CBOR_NO_ERROR) and > if (ret) could be used to determine there was no error during decoding --- src/cn-cbor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cn-cbor.c b/src/cn-cbor.c index 9093537..dd173ca 100644 --- a/src/cn-cbor.c +++ b/src/cn-cbor.c @@ -263,6 +263,8 @@ cn_cbor* cn_cbor_decode(const unsigned char* buf, size_t len CBOR_CONTEXT, cn_cb pb.err = CN_CBOR_NO_ERROR; ret = decode_item(&pb CBOR_CONTEXT_PARAM, &catcher); if (ret != NULL) { + if (errp) + errp->err = CN_CBOR_NO_ERROR; /* mark as top node */ ret->parent = NULL; } else {