diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-23 15:50:42 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-23 15:50:42 +0200 |
commit | e93ebb79dbb0d6715a297be2ddbf721ef2fda2bb (patch) | |
tree | 3b72e8b362a07609b17753d3b80ee4bb487b03e1 | |
parent | bd9c5d6648be43495181c96ea309ef3309b8e694 (diff) | |
download | rsyslog-e93ebb79dbb0d6715a297be2ddbf721ef2fda2bb.tar.gz rsyslog-e93ebb79dbb0d6715a297be2ddbf721ef2fda2bb.tar.bz2 rsyslog-e93ebb79dbb0d6715a297be2ddbf721ef2fda2bb.zip |
refactor: remove now no-longer needed functions
-rw-r--r-- | grammar/parserif.h | 1 | ||||
-rw-r--r-- | grammar/testdriver.c | 9 | ||||
-rw-r--r-- | runtime/msg.c | 72 | ||||
-rw-r--r-- | runtime/msg.h | 3 | ||||
-rw-r--r-- | runtime/rsconf.c | 24 |
5 files changed, 0 insertions, 109 deletions
diff --git a/grammar/parserif.h b/grammar/parserif.h index aa271ec4..6c2c1365 100644 --- a/grammar/parserif.h +++ b/grammar/parserif.h @@ -19,5 +19,4 @@ void cnfDoScript(struct cnfstmt *script); void cnfDoCfsysline(char *ln); void cnfDoBSDTag(char *ln); void cnfDoBSDHost(char *ln); -es_str_t *cnfGetVar(char *name, void *usrptr); #endif diff --git a/grammar/testdriver.c b/grammar/testdriver.c index b29626d4..58d204a3 100644 --- a/grammar/testdriver.c +++ b/grammar/testdriver.c @@ -87,15 +87,6 @@ void cnfDoBSDHost(char *ln) dbgprintf("global:BSD host: %s\n", ln); } -es_str_t* -cnfGetVar(char __attribute__((unused)) *name, - void __attribute__((unused)) *usrptr) -{ - es_str_t *estr; - estr = es_newStrFromCStr("", 1); - return estr; -} - int main(int argc, char *argv[]) { diff --git a/runtime/msg.c b/runtime/msg.c index a0215ab6..5224ccea 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -3679,78 +3679,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, } -/* The function returns a json variable suitable for use with RainerScript. - * Note: caller must free the returned string. - * Note that we need to do a lot of conversions between es_str_t and cstr -- this will go away once - * we have moved larger parts of rsyslog to es_str_t. Acceptable for the moment, especially as we intend - * to rewrite the script engine as well! - * rgerhards, 2010-12-03 - */ -static es_str_t* -msgGetJSONVarNew(msg_t *pMsg, struct json_object *jroot, char *name) -{ - uchar *leaf; - char *val; - es_str_t *estr = NULL; - struct json_object *json, *parent; - - ISOBJ_TYPE_assert(pMsg, msg); - - if(jroot == NULL) { - estr = es_newStr(1); - goto done; - } - leaf = jsonPathGetLeaf((uchar*)name, strlen(name)); - if(jsonPathFindParent(jroot, (uchar*)name, leaf, &parent, 1) != RS_RET_OK) { - estr = es_newStr(1); - goto done; - } - json = json_object_object_get(parent, (char*)leaf); - val = (char*)json_object_get_string(json); - estr = es_newStrFromCStr(val, strlen(val)); -done: - return estr; -} - -es_str_t* -msgGetCEEVarNew(msg_t *pMsg, char *name) -{ - return msgGetJSONVarNew(pMsg, pMsg->json, name); -} - -es_str_t* -msgGetLocalVarNew(msg_t *pMsg, char *name) -{ - return msgGetJSONVarNew(pMsg, pMsg->localvars, name); -} - -/* Return an es_str_t for given message property. - */ -es_str_t* -msgGetMsgVarNew(msg_t *pThis, uchar *name) -{ - rs_size_t propLen; - uchar *pszProp = NULL; - unsigned short bMustBeFreed = 0; - msgPropDescr_t mProp; - es_str_t *estr; - - ISOBJ_TYPE_assert(pThis, msg); - - /* always call MsgGetProp() without a template specifier */ - /* TODO: optimize propNameToID() call -- rgerhards, 2009-06-26 */ -#warning remove strlen() ? - msgPropDescrFill(&mProp, name, ustrlen(name)); - pszProp = (uchar*) MsgGetProp(pThis, NULL, &mProp, &propLen, &bMustBeFreed, NULL); - - estr = es_newStrFromCStr((char*)pszProp, propLen); - if(bMustBeFreed) - free(pszProp); - - return estr; -} - - /* This function can be used as a generic way to set properties. * We have to handle a lot of legacy, so our return value is not always * 100% correct (called functions do not always provide one, should diff --git a/runtime/msg.h b/runtime/msg.h index c19e7e36..a736958f 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -186,15 +186,12 @@ rsRetVal MsgReplaceMSG(msg_t *pThis, uchar* pszMSG, int lenMSG); uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, msgPropDescr_t *pProp, rs_size_t *pPropLen, unsigned short *pbMustBeFreed, struct syslogTime *ttNow); rsRetVal msgGetMsgVar(msg_t *pThis, cstr_t *pstrPropName, var_t **ppVar); -es_str_t* msgGetMsgVarNew(msg_t *pThis, uchar *name); uchar *getRcvFrom(msg_t *pM); void getTAG(msg_t *pM, uchar **ppBuf, int *piLen); char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt); char *getPRI(msg_t *pMsg); void getRawMsg(msg_t *pM, uchar **pBuf, int *piLen); rsRetVal msgGetCEEVar(msg_t *pThis, cstr_t *propName, var_t **ppVar); -es_str_t* msgGetCEEVarNew(msg_t *pMsg, char *name); -es_str_t* msgGetLocalVarNew(msg_t *pMsg, char *name); rsRetVal msgAddJSON(msg_t *pM, uchar *name, struct json_object *json); rsRetVal MsgGetSeverity(msg_t *pThis, int *piSeverity); rsRetVal MsgDeserialize(msg_t *pMsg, strm_t *pStrm); diff --git a/runtime/rsconf.c b/runtime/rsconf.c index 6c7c5fd5..e83f130e 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -479,30 +479,6 @@ void cnfDoBSDHost(char *ln) "solution (Block '%s')", ln); free(ln); } - -es_str_t* -cnfGetVar(char *name, void *usrptr) -{ - es_str_t *estr; - if(name[0] == '$') { - if(name[1] == '$') - estr = getSysVar(name+2); - else if(name[1] == '!') - estr = msgGetCEEVarNew((msg_t*) usrptr, name+2); - else - estr = msgGetMsgVarNew((msg_t*) usrptr, (uchar*)name); - } else { /* if this happens, we have a program logic error */ - estr = es_newStrFromCStr("err: var must start with $", - sizeof("err: var must start with $")-1); - } - if(Debug) { - char *s; - s = es_str2cstr(estr, NULL); - dbgprintf("rainerscript: var '%s': '%s'\n", name, s); - free(s); - } - return estr; -} /*------------------------------ end interface to flex/bison parser ------------------------------*/ |