Skip to content

Commit

Permalink
Add a json_c_version.h header (included from json.h), and several mac…
Browse files Browse the repository at this point in the history
…ros and functions for retrieving the json-c version at compile-time and run-time.
  • Loading branch information
hawicz committed Dec 23, 2012
1 parent d7de3aa commit 1461b49
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ libjson_cinclude_HEADERS = \
debug.h \
json.h \
json_config.h \
json_c_version.h \
json_inttypes.h \
json_object.h \
json_object_iterator.h \
Expand Down Expand Up @@ -48,6 +49,7 @@ endif
libjson_c_la_SOURCES = \
arraylist.c \
debug.c \
json_c_version.c \
json_object.c \
json_object_iterator.c \
json_tokener.c \
Expand Down
1 change: 1 addition & 0 deletions json.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extern "C" {
#include "json_object.h"
#include "json_tokener.h"
#include "json_object_iterator.h"
#include "json_c_version.h"

#ifdef __cplusplus
}
Expand Down
20 changes: 20 additions & 0 deletions json_c_version.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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.
*/
#include "config.h"

#include "json_c_version.h"

const char *json_c_version(void)
{
return JSON_C_VERSION;
}

int json_c_version_num(void)
{
return JSON_C_VERSION_NUM;
}

22 changes: 22 additions & 0 deletions json_c_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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 _json_c_version_h_
#define _json_c_version_h_

#define JSON_C_MAJOR_VERSION 0
#define JSON_C_MINOR_VERSION 10
#define JSON_C_MICRO_VERSION 0
#define JSON_C_VERSION_NUM ((JSON_C_MAJOR_VERSION << 16) | \
(JSON_C_MINOR_VERSION << 8) | \
JSON_C_MICRO_VERSION)
#define JSON_C_VERSION "0.10"

const char *json_c_version(void); /* Returns JSON_C_VERSION */
int json_c_version_num(void); /* Returns JSON_C_VERSION_NUM */

#endif

0 comments on commit 1461b49

Please sign in to comment.