Message ID | 20200422124049.241775-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | lib: fwts_json.h: define TRUE and FALSE for newer versions of json-c (LP: #1874224) | expand |
On 2020-04-22 6:40 a.m., Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > BugLink: https://bugs.launchpad.net/bugs/1874224 > > json-c-0.14 does not provide TRUE/FALSE defines anymore, and instead > only uses 1/0 directly. Add in the defines for TRUE/FALSE if they > don't exist already. > > Thanks to Björn Esser for the fix from originally from > https://src.fedoraproject.org/rpms/fwts/c/2d53ef23970e but with > the JSON_C_VERSION_NUM removed as we don't need to be overly > pedantic here. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/include/fwts_json.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/src/lib/include/fwts_json.h b/src/lib/include/fwts_json.h > index 747c4bdb..ad51bc45 100644 > --- a/src/lib/include/fwts_json.h > +++ b/src/lib/include/fwts_json.h > @@ -31,4 +31,17 @@ > #define FWTS_JSON_ERROR(ptr) \ > ( (ptr == NULL) || ((const json_object *)ptr == __FWTS_JSON_ERR_PTR__) ) > > +/* > + * json-c 0.13.99 does not define TRUE/FALSE anymore > + * the json-c maintainers replaced them with pure 1/0 > + * https://github.com/json-c/json-c/commit/0992aac61f8b > + */ > +#ifndef FALSE > +#define FALSE 0 > +#endif > + > +#ifndef TRUE > +#define TRUE 1 > +#endif > + > #endif > Acked-by: Alex Hung <alex.hung@canonical.com>
On 4/22/20 8:40 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > BugLink: https://bugs.launchpad.net/bugs/1874224 > > json-c-0.14 does not provide TRUE/FALSE defines anymore, and instead > only uses 1/0 directly. Add in the defines for TRUE/FALSE if they > don't exist already. > > Thanks to Björn Esser for the fix from originally from > https://src.fedoraproject.org/rpms/fwts/c/2d53ef23970e but with > the JSON_C_VERSION_NUM removed as we don't need to be overly > pedantic here. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/include/fwts_json.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/src/lib/include/fwts_json.h b/src/lib/include/fwts_json.h > index 747c4bdb..ad51bc45 100644 > --- a/src/lib/include/fwts_json.h > +++ b/src/lib/include/fwts_json.h > @@ -31,4 +31,17 @@ > #define FWTS_JSON_ERROR(ptr) \ > ( (ptr == NULL) || ((const json_object *)ptr == __FWTS_JSON_ERR_PTR__) ) > > +/* > + * json-c 0.13.99 does not define TRUE/FALSE anymore > + * the json-c maintainers replaced them with pure 1/0 > + * https://github.com/json-c/json-c/commit/0992aac61f8b > + */ > +#ifndef FALSE > +#define FALSE 0 > +#endif > + > +#ifndef TRUE > +#define TRUE 1 > +#endif > + > #endif > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/lib/include/fwts_json.h b/src/lib/include/fwts_json.h index 747c4bdb..ad51bc45 100644 --- a/src/lib/include/fwts_json.h +++ b/src/lib/include/fwts_json.h @@ -31,4 +31,17 @@ #define FWTS_JSON_ERROR(ptr) \ ( (ptr == NULL) || ((const json_object *)ptr == __FWTS_JSON_ERR_PTR__) ) +/* + * json-c 0.13.99 does not define TRUE/FALSE anymore + * the json-c maintainers replaced them with pure 1/0 + * https://github.com/json-c/json-c/commit/0992aac61f8b + */ +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + #endif