summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-01-14 16:57:04 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-01-14 16:57:04 +0100
commiteb97d25219a279daceca29c08e68c864b5629901 (patch)
tree996f1cbfc5cb3282ec88eb3f8767582cc2c14307
parentbeed1bda6969b70b608ff9e606f52ac6d41cc8c1 (diff)
downloadrsyslog-eb97d25219a279daceca29c08e68c864b5629901.tar.gz
rsyslog-eb97d25219a279daceca29c08e68c864b5629901.tar.bz2
rsyslog-eb97d25219a279daceca29c08e68c864b5629901.zip
optimize: use built-in str comparison, as this is optimized in assembly
do only when possible. However, the profiler only shows as *very* minimal effect.
-rw-r--r--runtime/stringbuf.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c
index 5bca009d..d9f80231 100644
--- a/runtime/stringbuf.c
+++ b/runtime/stringbuf.c
@@ -870,13 +870,7 @@ int rsCStrSzStrCmp(cstr_t *pCS1, uchar *psz, size_t iLenSz)
* length, so we need to actually check if they
* are equal.
*/
- register size_t i;
- for(i = 0 ; i < iLenSz ; ++i) {
- if(pCS1->pBuf[i] != psz[i])
- return pCS1->pBuf[i] - psz[i];
- }
- /* if we arrive here, the strings are equal */
- return 0;
+ return strncmp((char*)pCS1->pBuf, (char*)psz, iLenSz);
}
else
return pCS1->iStrLen - iLenSz;