aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-11-02 13:33:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-11-02 13:33:16 +0200
commitd249dff880edd1520a979279934afc0a6370bd67 (patch)
tree7168f2b10aa0e5872c756e62f9db5c284f1ea8cf
parent90b6ea19de89b30f592d6d8dfbfd616686627681 (diff)
Avoid bcopy/bzero macro redefinition in sha1.c
-rw-r--r--libbutl/sha1.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libbutl/sha1.c b/libbutl/sha1.c
index 37e862e..98fce5e 100644
--- a/libbutl/sha1.c
+++ b/libbutl/sha1.c
@@ -121,11 +121,17 @@ main ()
#include <string.h>
+/* Assume if bzero/bcopy are defined as macros, then they do what we need. */
+
/* void bzero(void *s, size_t n); */
-#define bzero(s, n) memset((s), 0, (n))
+#ifndef bzero
+# define bzero(s, n) memset((s), 0, (n))
+#endif
/* void bcopy(const void *s1, void *s2, size_t n); */
-#define bcopy(s1, s2, n) memmove((s2), (s1), (n))
+#ifndef bcopy
+# define bcopy(s1, s2, n) memmove((s2), (s1), (n))
+#endif
/* The rest is the unmodified (except for adjusting function declarations and
adding a few explicit casts to make compilable in C++ without warnings)