Finally compiles under RHEL7
This commit is contained in:
16
protocol.c
16
protocol.c
@ -15,7 +15,7 @@
|
||||
#include <outcode.h>
|
||||
#include <dynstring.h>
|
||||
#include "protocol.h"
|
||||
#include <json/json.h>
|
||||
#include <json-c/json.h>
|
||||
|
||||
#define MAXMSG 1024
|
||||
#define INIT_STR_SIZE 256
|
||||
@ -492,7 +492,7 @@ struct json_object *mkJSON_Object(SConnection * pCon, char *pBuffer,
|
||||
|
||||
pBueffel[0] = '\0';
|
||||
msg_json = json_object_new_object();
|
||||
if (is_error(msg_json)) {
|
||||
if (msg_json == NULL) {
|
||||
linenum = __LINE__;
|
||||
goto reporterr;
|
||||
}
|
||||
@ -518,7 +518,7 @@ struct json_object *mkJSON_Object(SConnection * pCon, char *pBuffer,
|
||||
}
|
||||
if (iOut == eHdbValue || iOut == eHdbEvent) {
|
||||
tmp_json = json_tokener_parse(pBuffer);
|
||||
if (is_error(tmp_json)) {
|
||||
if (tmp_json == NULL) {
|
||||
linenum = __LINE__;
|
||||
goto reporterr;
|
||||
}
|
||||
@ -533,7 +533,7 @@ struct json_object *mkJSON_Object(SConnection * pCon, char *pBuffer,
|
||||
pBufferTo++;
|
||||
}
|
||||
tmp_json = json_object_new_string(pBuffer);
|
||||
if (is_error(tmp_json)) {
|
||||
if (tmp_json == NULL) {
|
||||
linenum = __LINE__;
|
||||
goto reporterr;
|
||||
}
|
||||
@ -548,9 +548,9 @@ reporterr:
|
||||
SCWrite(pCon, pError, eError);
|
||||
SCSetWriteFunc(pCon, SCWriteJSON_String);
|
||||
cleanup:
|
||||
if (tmp_json != NULL && !is_error(tmp_json))
|
||||
if (tmp_json != NULL)
|
||||
json_object_put(tmp_json);
|
||||
if (msg_json != NULL && !is_error(msg_json))
|
||||
if (msg_json != NULL)
|
||||
json_object_put(msg_json);
|
||||
return NULL;
|
||||
}
|
||||
@ -598,9 +598,9 @@ int SCWriteJSON_String(SConnection * pCon, char *pBuffer, int iOut)
|
||||
iRet = SCDoSockWrite(pCon, (char *)json_object_to_json_string(my_object));
|
||||
}
|
||||
}
|
||||
if (tmp_json != NULL && !is_error(tmp_json))
|
||||
if (tmp_json != NULL )
|
||||
json_object_put(tmp_json);
|
||||
if (my_object != NULL && !is_error(my_object))
|
||||
if (my_object != NULL )
|
||||
json_object_put(my_object);
|
||||
return iRet;
|
||||
}
|
||||
|
Reference in New Issue
Block a user