undo interface changes to getTime* functions

I originally thought that I would need to do dynamic memory
alloc and extended the interface to support this. Fortunatley,
this could be avoided, and so I undo that change now.
This commit is contained in:
Rainer Gerhards 2014-04-30 12:01:01 +02:00
parent 7cb672740b
commit 196c6c8e74
6 changed files with 11 additions and 11 deletions

View File

@ -1567,7 +1567,7 @@ getPRI(msg_t * const pM)
char * char *
getTimeReported(msg_t * const pM, enum tplFormatTypes eFmt, unsigned short *__restrict__ const pbMustBeFreed) getTimeReported(msg_t * const pM, enum tplFormatTypes eFmt)
{ {
BEGINfunc BEGINfunc
if(pM == NULL) if(pM == NULL)
@ -1662,7 +1662,7 @@ getTimeReported(msg_t * const pM, enum tplFormatTypes eFmt, unsigned short *__re
return "INVALID eFmt OPTION!"; return "INVALID eFmt OPTION!";
} }
static char *getTimeGenerated(msg_t * const pM, enum tplFormatTypes eFmt, unsigned short *__restrict__ const pbMustBeFreed) static char *getTimeGenerated(msg_t * const pM, enum tplFormatTypes eFmt)
{ {
BEGINfunc BEGINfunc
if(pM == NULL) if(pM == NULL)
@ -2030,7 +2030,7 @@ msgGetJSONMESG(msg_t *__restrict__ const pMsg)
jval = json_object_new_string((char*)pRes); jval = json_object_new_string((char*)pRes);
json_object_object_add(json, "rawmsg", jval); json_object_object_add(json, "rawmsg", jval);
pRes = (uchar*)getTimeReported(pMsg, tplFmtRFC3339Date, NULL); pRes = (uchar*)getTimeReported(pMsg, tplFmtRFC3339Date);
jval = json_object_new_string((char*)pRes); jval = json_object_new_string((char*)pRes);
json_object_object_add(json, "timereported", jval); json_object_object_add(json, "timereported", jval);
@ -2060,7 +2060,7 @@ msgGetJSONMESG(msg_t *__restrict__ const pMsg)
jval = json_object_new_string(getSeverity(pMsg)); jval = json_object_new_string(getSeverity(pMsg));
json_object_object_add(json, "syslogseverity", jval); json_object_object_add(json, "syslogseverity", jval);
pRes = (uchar*)getTimeGenerated(pMsg, tplFmtRFC3339Date, NULL); pRes = (uchar*)getTimeGenerated(pMsg, tplFmtRFC3339Date);
jval = json_object_new_string((char*)pRes); jval = json_object_new_string((char*)pRes);
json_object_object_add(json, "timegenerated", jval); json_object_object_add(json, "timegenerated", jval);
@ -3051,7 +3051,7 @@ uchar *MsgGetProp(msg_t *__restrict__ const pMsg, struct templateEntry *__restri
datefmt = pTpe->data.field.eDateFormat; datefmt = pTpe->data.field.eDateFormat;
else else
datefmt = tplFmtDefault; datefmt = tplFmtDefault;
pRes = (uchar*)getTimeReported(pMsg, datefmt, pbMustBeFreed); pRes = (uchar*)getTimeReported(pMsg, datefmt);
break; break;
case PROP_HOSTNAME: case PROP_HOSTNAME:
pRes = (uchar*)getHOSTNAME(pMsg); pRes = (uchar*)getHOSTNAME(pMsg);
@ -3105,7 +3105,7 @@ uchar *MsgGetProp(msg_t *__restrict__ const pMsg, struct templateEntry *__restri
datefmt = pTpe->data.field.eDateFormat; datefmt = pTpe->data.field.eDateFormat;
else else
datefmt = tplFmtDefault; datefmt = tplFmtDefault;
pRes = (uchar*)getTimeGenerated(pMsg, datefmt, pbMustBeFreed); pRes = (uchar*)getTimeGenerated(pMsg, datefmt);
break; break;
case PROP_PROGRAMNAME: case PROP_PROGRAMNAME:
pRes = getProgramName(pMsg, LOCK_MUTEX); pRes = getProgramName(pMsg, LOCK_MUTEX);

View File

@ -187,7 +187,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, msgPropDescr_t *pProp
rs_size_t *pPropLen, unsigned short *pbMustBeFreed, struct syslogTime *ttNow); rs_size_t *pPropLen, unsigned short *pbMustBeFreed, struct syslogTime *ttNow);
uchar *getRcvFrom(msg_t *pM); uchar *getRcvFrom(msg_t *pM);
void getTAG(msg_t *pM, uchar **ppBuf, int *piLen); void getTAG(msg_t *pM, uchar **ppBuf, int *piLen);
char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt, unsigned short *pbMustBeFreed); char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt);
char *getPRI(msg_t *pMsg); char *getPRI(msg_t *pMsg);
void getRawMsg(msg_t *pM, uchar **pBuf, int *piLen); void getRawMsg(msg_t *pM, uchar **pBuf, int *piLen);
rsRetVal msgAddJSON(msg_t *pM, uchar *name, struct json_object *json); rsRetVal msgAddJSON(msg_t *pM, uchar *name, struct json_object *json);

View File

@ -74,7 +74,7 @@ BEGINstrgen
size_t lenTotal; size_t lenTotal;
CODESTARTstrgen CODESTARTstrgen
/* first obtain all strings and their length (if not fixed) */ /* first obtain all strings and their length (if not fixed) */
pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3339Date, NULL); pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3339Date);
lenTimeStamp = ustrlen(pTimeStamp); lenTimeStamp = ustrlen(pTimeStamp);
pHOSTNAME = (uchar*) getHOSTNAME(pMsg); pHOSTNAME = (uchar*) getHOSTNAME(pMsg);
lenHOSTNAME = getHOSTNAMELen(pMsg); lenHOSTNAME = getHOSTNAMELen(pMsg);

View File

@ -75,7 +75,7 @@ CODESTARTstrgen
/* first obtain all strings and their length (if not fixed) */ /* first obtain all strings and their length (if not fixed) */
pPRI = getPRI(pMsg); pPRI = getPRI(pMsg);
lenPRI = strlen(pPRI); lenPRI = strlen(pPRI);
pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3339Date, NULL); pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3339Date);
lenTimeStamp = ustrlen(pTimeStamp); lenTimeStamp = ustrlen(pTimeStamp);
pHOSTNAME = (uchar*) getHOSTNAME(pMsg); pHOSTNAME = (uchar*) getHOSTNAME(pMsg);
lenHOSTNAME = getHOSTNAMELen(pMsg); lenHOSTNAME = getHOSTNAMELen(pMsg);

View File

@ -70,7 +70,7 @@ BEGINstrgen
size_t lenTotal; size_t lenTotal;
CODESTARTstrgen CODESTARTstrgen
/* first obtain all strings and their length (if not fixed) */ /* first obtain all strings and their length (if not fixed) */
pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3164Date, NULL); pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3164Date);
pHOSTNAME = (uchar*) getHOSTNAME(pMsg); pHOSTNAME = (uchar*) getHOSTNAME(pMsg);
lenHOSTNAME = getHOSTNAMELen(pMsg); lenHOSTNAME = getHOSTNAMELen(pMsg);
getTAG(pMsg, &pTAG, &lenTAG); getTAG(pMsg, &pTAG, &lenTAG);

View File

@ -74,7 +74,7 @@ CODESTARTstrgen
/* first obtain all strings and their length (if not fixed) */ /* first obtain all strings and their length (if not fixed) */
pPRI = getPRI(pMsg); pPRI = getPRI(pMsg);
lenPRI = strlen(pPRI); lenPRI = strlen(pPRI);
pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3164Date, NULL); pTimeStamp = (uchar*) getTimeReported(pMsg, tplFmtRFC3164Date);
pHOSTNAME = (uchar*) getHOSTNAME(pMsg); pHOSTNAME = (uchar*) getHOSTNAME(pMsg);
lenHOSTNAME = getHOSTNAMELen(pMsg); lenHOSTNAME = getHOSTNAMELen(pMsg);
getTAG(pMsg, &pTAG, &lenTAG); getTAG(pMsg, &pTAG, &lenTAG);