diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-22 16:55:21 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-22 16:55:21 +0100 |
commit | 35bec820b601bfcf9eff314fbfc718bb8949bda1 (patch) | |
tree | e67ec971d8d89df26727330e527df955535410f3 /runtime/prop.c | |
parent | 45d11af0b9975937e536d1c9b6d7bdaff5ade1b0 (diff) | |
download | rsyslog-35bec820b601bfcf9eff314fbfc718bb8949bda1.tar.gz rsyslog-35bec820b601bfcf9eff314fbfc718bb8949bda1.tar.bz2 rsyslog-35bec820b601bfcf9eff314fbfc718bb8949bda1.zip |
optimze: reduce memory operations during dns resolution/hostname setting
previously, hostname and ip strings were shuffled to the msg object, which
created a property out of them. Now the cache holds the property, and it
is resused (almost) everywhere, what saves a lot of memory operations.
The only exception is imtcp session setup, where different handling
of the hostname is done, which we need to sort out (but that's another
story).
Diffstat (limited to 'runtime/prop.c')
-rw-r--r-- | runtime/prop.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/prop.c b/runtime/prop.c index a1f51ed1..cb89fac0 100644 --- a/runtime/prop.c +++ b/runtime/prop.c @@ -100,8 +100,7 @@ static int GetStringLen(prop_t *pThis) /* get string */ -rsRetVal -propGetString(prop_t *pThis, uchar **ppsz, int *plen) +rsRetVal GetString(prop_t *pThis, uchar **ppsz, int *plen) { BEGINfunc ISOBJ_TYPE_assert(pThis, prop); @@ -174,7 +173,7 @@ rsRetVal CreateOrReuseStringProp(prop_t **ppThis, uchar *psz, int len) CHKiRet(CreateStringProp(ppThis, psz, len)); } else { /* already exists, check if we can re-use it */ - propGetString(*ppThis, &pszPrev, &lenPrev); + GetString(*ppThis, &pszPrev, &lenPrev); if(len != lenPrev || ustrcmp(psz, pszPrev)) { /* different, need to discard old & create new one */ propDestruct(ppThis); @@ -213,7 +212,7 @@ CODESTARTobjQueryInterface(prop) pIf->Destruct = propDestruct; pIf->DebugPrint = propDebugPrint; pIf->SetString = SetString; - pIf->GetString = propGetString; + pIf->GetString = GetString; pIf->GetStringLen = GetStringLen; pIf->AddRef = AddRef; pIf->CreateStringProp = CreateStringProp; |