From 71c673f02249314b9d31ecfc2790638ee2f318fe Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 6 Apr 2016 10:05:15 +0200 Subject: [PATCH] use configure VERSION in fjson_version() API see also https://github.com/rsyslog/libfastjson/issues/11#issuecomment-206049907 closes https://github.com/rsyslog/libfastjson/issues/29 --- ChangeLog | 2 ++ DIFFERENCES | 15 +++++++++++++++ Makefile.am | 3 +-- json.h | 10 +++++++--- json_c_version.h | 22 ---------------------- json_c_version.c => json_version.c | 14 ++++---------- 6 files changed, 29 insertions(+), 37 deletions(-) delete mode 100644 json_c_version.h rename json_c_version.c => json_version.c (59%) diff --git a/ChangeLog b/ChangeLog index 1455982..267151a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 0.99.3 2016-0?-?? +- fjson_version now returns configure VERSION + This avoid inconsistency. - removal of Windows and Android bits Thanks to Michael Biebl for the patch. - fixes of the build system diff --git a/DIFFERENCES b/DIFFERENCES index d49ad98..77b5fb3 100644 --- a/DIFFERENCES +++ b/DIFFERENCES @@ -1,4 +1,5 @@ Differences to json-c +--------------------- * hash tables are no longer part of the API; we may use them internally, but we may also use any other data structure. This @@ -17,3 +18,17 @@ Differences to json-c maintain libfastjson on those platforms, please let us know and we can work together (a long term commitment) to get this going again. + +* removed API calls: + If you need any of this API calls urgently, please let us know + why you consider it important enough to become re-added; + especially let us know why you think this is important to the + community at large. Thanks. + * [f]json_c_version_num() + +* renamed API calls: + * all calls have been added an "f" in the front + json_* --> fjson_* + * the same holds true for preprocessor defines, + JSON_C_* --> FJSON_* (note removal of "_C") + * json_c_version() -> fjson_version() diff --git a/Makefile.am b/Makefile.am index bb35fc2..d056d5d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,6 @@ libfastjsoninclude_HEADERS = \ debug.h \ json.h \ json_config.h \ - json_c_version.h \ json_inttypes.h \ json_object.h \ json_object_iterator.h \ @@ -38,7 +37,7 @@ libfastjson_la_CPPFLAGS = -Werror libfastjson_la_SOURCES = \ arraylist.c \ debug.c \ - json_c_version.c \ + json_version.c \ json_object.c \ json_object_iterator.c \ json_tokener.c \ diff --git a/json.h b/json.h index 15ab96d..ae6cc38 100644 --- a/json.h +++ b/json.h @@ -4,6 +4,8 @@ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. * Michael Clark * Copyright (c) 2009 Hewlett-Packard Development Company, L.P. + * Copyright (c) 2016 Adiscon GmbH + * Rainer Gerhards * * This library is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See COPYING for details. @@ -24,7 +26,6 @@ extern "C" { #include "json_object.h" #include "json_tokener.h" #include "json_object_iterator.h" -#include "json_c_version.h" /** * Set initial size allocation for memory when creating strings, @@ -45,8 +46,11 @@ extern "C" { * * @param size new initial size for printbuf (formatting buffer) */ -extern void -fjson_global_set_printbuf_initial_size(int size); +extern void fjson_global_set_printbuf_initial_size(int size); +/** + * report the current libfastjson version + */ +extern const char *fjson_version(void); #ifdef __cplusplus } #endif diff --git a/json_c_version.h b/json_c_version.h deleted file mode 100644 index 5c953c4..0000000 --- a/json_c_version.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2012 Eric Haszlakiewicz - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See COPYING for details. - */ - -#ifndef _fj_json_c_version_h_ -#define _fj_json_c_version_h_ - -#define FJSON_MAJOR_VERSION 0 -#define FJSON_MINOR_VERSION 12 -#define FJSON_MICRO_VERSION 99 -#define FJSON_VERSION_NUM ((FJSON_MAJOR_VERSION << 16) | \ - (FJSON_MINOR_VERSION << 8) | \ - FJSON_MICRO_VERSION) -#define FJSON_VERSION "0.12.99" - -const char *fjson_c_version(void); /* Returns FJSON_VERSION */ -int fjson_c_version_num(void); /* Returns FJSON_VERSION_NUM */ - -#endif diff --git a/json_c_version.c b/json_version.c similarity index 59% rename from json_c_version.c rename to json_version.c index e31eecc..90582ad 100644 --- a/json_c_version.c +++ b/json_version.c @@ -1,20 +1,14 @@ /* * Copyright (c) 2012 Eric Haszlakiewicz + * Copyright (c) 2016 Adiscon GmbH + * Rainer Gerhards * * This library is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See COPYING for details. */ #include "config.h" -#include "json_c_version.h" - -const char *fjson_c_version(void) +const char *fjson_version(void) { - return FJSON_VERSION; + return VERSION; } - -int fjson_c_version_num(void) -{ - return FJSON_VERSION_NUM; -} -