refactor: remove now no-longer needed functions

This commit is contained in:
Rainer Gerhards 2013-10-23 15:50:42 +02:00
parent bd9c5d6648
commit e93ebb79db
5 changed files with 0 additions and 109 deletions

View File

@ -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

View File

@ -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[])
{

View File

@ -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

View File

@ -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);

View File

@ -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 ------------------------------*/