From d249dff880edd1520a979279934afc0a6370bd67 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 2 Nov 2023 13:33:16 +0200 Subject: Avoid bcopy/bzero macro redefinition in sha1.c --- libbutl/sha1.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libbutl') 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 +/* 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) -- cgit v1.1