diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-18 14:40:41 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-18 14:40:41 +0100 |
commit | eb5c7a04199028703a328d199c36ac6f5b631ccd (patch) | |
tree | c0cb250fa64025f0e9a953b2f4c3af62ac1a13eb /runtime/net.c | |
parent | 947cc0a45ddf7144532f37626fa0c547e357e3af (diff) | |
download | rsyslog-eb5c7a04199028703a328d199c36ac6f5b631ccd.tar.gz rsyslog-eb5c7a04199028703a328d199c36ac6f5b631ccd.tar.bz2 rsyslog-eb5c7a04199028703a328d199c36ac6f5b631ccd.zip |
optimize: reduce nbr of strcpy() in FROMHOST processing
Diffstat (limited to 'runtime/net.c')
-rw-r--r-- | runtime/net.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/net.c b/runtime/net.c index 1a8f2438..a6670eca 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -1125,9 +1125,11 @@ void debugListenInfo(int fd, char *type) * pay. * 2005-05-16 rgerhards: added IP representation. Must also be NI_MAXHOST */ -rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN, uchar *pszIP) +rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN, uchar **pszIP, rs_size_t *lenIP) { DEFiRet; + uchar *host; + rs_size_t lenHost; register uchar *p; int count; @@ -1135,7 +1137,8 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN assert(pszHost != NULL); assert(pszHostFQDN != NULL); - iRet = dnscacheLookup(f, pszHostFQDN, pszIP); + iRet = dnscacheLookup(f, &host, &lenHost, pszIP, lenIP); + strcpy((char*)pszHostFQDN, (char*)host); // TODO: optimize this! requires more changes below (dirty tricks ;)) if(iRet == RS_RET_INVALID_SOURCE) { strcpy((char*) pszHost, (char*) pszHostFQDN); /* we use whatever was provided as replacement */ |