summaryrefslogtreecommitdiff
path: root/lib/string.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2019-08-14 10:28:23 +0200
committerMaria Matejka <mq@ucw.cz>2020-04-28 16:21:06 +0200
commitd607205486d7ea11f2cbf3dcc3d5e7e6b53f1d0f (patch)
tree6853316920bf9ab37dd0e493377bdef67af00278 /lib/string.h
parent124d860f648f4c1c080e77b5f070b97d094f5285 (diff)
Not calling memcpy with n=0.
Diffstat (limited to 'lib/string.h')
-rw-r--r--lib/string.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/string.h b/lib/string.h
index d6ae5ef7..0f650178 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -72,6 +72,15 @@ bstrcmp(const char *s1, const char *s2)
return !s2 - !s1;
}
+static inline void *
+bmemcpy(void *dest, const void *src, size_t n)
+{
+ if (n)
+ return memcpy(dest, src, n);
+ else
+ return dest;
+}
+
#define ROUTER_ID_64_LENGTH 23
#endif