[libvirt] [PATCH] virjson: drop compatibility macros

Ján Tomko posted 1 patch 6 years, 10 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/e4571a42dc7c1eaa6d9c0fe37ed9b89c29f68d68.1554294895.git.jtomko@redhat.com
src/util/virjson.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
[libvirt] [PATCH] virjson: drop compatibility macros
Posted by Ján Tomko 6 years, 10 months ago
Since commit 66460e3 dropped support for YAJL 1, we no longer need
these.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/util/virjson.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/util/virjson.c b/src/util/virjson.c
index bb4052ba81..1dceb746b9 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -34,8 +34,6 @@
 # include <yajl/yajl_gen.h>
 # include <yajl/yajl_parse.h>
 
-# define yajl_size_t size_t
-# define VIR_YAJL_STATUS_OK(status) ((status) == yajl_status_ok)
 #endif
 
 /* XXX fixme */
@@ -1615,7 +1613,7 @@ virJSONParserHandleBoolean(void *ctx,
 static int
 virJSONParserHandleNumber(void *ctx,
                           const char *s,
-                          yajl_size_t l)
+                          size_t l)
 {
     virJSONParserPtr parser = ctx;
     char *str;
@@ -1643,7 +1641,7 @@ virJSONParserHandleNumber(void *ctx,
 static int
 virJSONParserHandleString(void *ctx,
                           const unsigned char *stringVal,
-                          yajl_size_t stringLen)
+                          size_t stringLen)
 {
     virJSONParserPtr parser = ctx;
     virJSONValuePtr value = virJSONValueNewStringLen((const char *)stringVal,
@@ -1666,7 +1664,7 @@ virJSONParserHandleString(void *ctx,
 static int
 virJSONParserHandleMapKey(void *ctx,
                           const unsigned char *stringVal,
-                          yajl_size_t stringLen)
+                          size_t stringLen)
 {
     virJSONParserPtr parser = ctx;
     virJSONParserStatePtr state;
@@ -1824,7 +1822,7 @@ virJSONValueFromString(const char *jsonstring)
 
     /* Yajl 2 is nice enough to default to rejecting trailing garbage. */
     rc = yajl_parse(hand, (const unsigned char *)jsonstring, len);
-    if (!VIR_YAJL_STATUS_OK(rc) ||
+    if (rc != yajl_status_ok ||
         yajl_complete_parse(hand) != yajl_status_ok) {
         unsigned char *errstr = yajl_get_error(hand, 1,
                                                (const unsigned char*)jsonstring,
@@ -1935,7 +1933,7 @@ virJSONValueToBuffer(virJSONValuePtr object,
 {
     yajl_gen g;
     const unsigned char *str;
-    yajl_size_t len;
+    size_t len;
     int ret = -1;
 
     VIR_DEBUG("object=%p", object);
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virjson: drop compatibility macros
Posted by Daniel P. Berrangé 6 years, 10 months ago
On Wed, Apr 03, 2019 at 02:34:56PM +0200, Ján Tomko wrote:
> Since commit 66460e3 dropped support for YAJL 1, we no longer need
> these.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/util/virjson.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virjson: drop compatibility macros
Posted by Peter Krempa 6 years, 10 months ago
On Wed, Apr 03, 2019 at 14:34:56 +0200, Ján Tomko wrote:
> Since commit 66460e3 dropped support for YAJL 1, we no longer need
> these.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/util/virjson.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)

ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list