aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kahles <david.kahles96@gmail.com>2016-01-28 19:59:49 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-02-09 10:35:45 +0100
commitd3bf8790821088dfad1fb476f865e0114871d263 (patch)
treed88434e04ef38aa0596514156c2f01ed69b730b5
parent1017b5537a79706c6b8a202f82b75172816c6f96 (diff)
downloadcsync-d3bf8790821088dfad1fb476f865e0114871d263.tar.gz
csync-d3bf8790821088dfad1fb476f865e0114871d263.tar.xz
csync-d3bf8790821088dfad1fb476f865e0114871d263.zip
log: Use unlikely macro
It's very unlikely that the error code is unknown. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/std/c_strerror.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/std/c_strerror.c b/src/std/c_strerror.c
index 631cafe..0709cbb 100644
--- a/src/std/c_strerror.c
+++ b/src/std/c_strerror.c
@@ -26,13 +26,14 @@
#include "config.h"
#include <string.h>
#include "c_strerror.h"
+#include "c_macro.h"
#ifndef HAVE_STRERROR_R
#define strerror_r(errnum, buf, buflen) snprintf(buf, buflen, "%s", strerror(errnum))
#endif
void c_strerror_r(int errnum, char *buf, size_t buflen){
- if(strerror_r(errnum, buf, buflen) != 0){
+ if(unlikely(strerror_r(errnum, buf, buflen) != 0)){
strncpy(buf, "Unknown error code", buflen - 1);
buf[buflen - 1] = '\0';
}