[chromecast] json-c < 0.11 compability
This commit is contained in:
parent
a2222c8a52
commit
598ae1bd71
|
@ -188,9 +188,9 @@ AS_IF([test "x$enable_chromecast" = "xyes"], [
|
|||
AC_DEFINE(CHROMECAST, 1, [Define to 1 to enable Chromecast support])
|
||||
PKG_CHECK_MODULES(LIBPROTOBUF_C, [ libprotobuf-c >= 1.0.0 ], , [ protobuf_old="yes" ])
|
||||
PKG_CHECK_MODULES(GNUTLS, [ gnutls ])
|
||||
PKG_CHECK_EXISTS([ json-c ],
|
||||
PKG_CHECK_EXISTS([ json-c >= 0.11 ],
|
||||
[ PKG_CHECK_MODULES(JSON_C, [ json-c ]) ],
|
||||
[ PKG_CHECK_MODULES(JSON_C, [ json ]) ]
|
||||
[ PKG_CHECK_MODULES(JSON_C, [ json ], AC_DEFINE(HAVE_JSON_C_OLD, 1, [Define 1 to if you have json-c < 0.11])) ]
|
||||
)
|
||||
])
|
||||
AS_IF([test "x$protobuf_old" = "xyes"], [
|
||||
|
|
|
@ -35,10 +35,14 @@
|
|||
#include <fcntl.h>
|
||||
#include <endian.h>
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <json-c/json.h>
|
||||
|
||||
#include <event2/event.h>
|
||||
|
||||
#ifdef HAVE_JSON_C_OLD
|
||||
# include <json/json.h>
|
||||
#else
|
||||
# include <json-c/json.h>
|
||||
#endif
|
||||
|
||||
#include "conffile.h"
|
||||
#include "mdns.h"
|
||||
#include "logger.h"
|
||||
|
@ -705,8 +709,12 @@ cast_msg_parse(struct cast_msg_payload *payload, char *s)
|
|||
static void
|
||||
cast_msg_parse_free(void *haystack)
|
||||
{
|
||||
#ifdef HAVE_JSON_C_OLD
|
||||
json_object_put((json_object *)haystack);
|
||||
#else
|
||||
if (json_object_put((json_object *)haystack) != 1)
|
||||
DPRINTF(E_LOG, L_CAST, "Memleak: JSON parser did not free object\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue