[PATCH 6/9] conditionally include sys/param.h
Michael Haubenwallner
michael.haubenwallner at ssi-schaefer.com
Mon Apr 10 11:10:43 UTC 2017
Indeed there are platforms without sys/param.h, so we really should
respect the check result, and eventually define MIN ourselve.
---
src/helper.c | 6 ++++++
src/sha1.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/helper.c b/src/helper.c
index 5548f31..7e59af7 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -13,7 +13,9 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
+#endif
#include <sys/stat.h>
#include <errno.h>
@@ -25,6 +27,10 @@
#include <hashinc>
+#ifndef MIN
+# define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#endif
+
/* ARGSUSED */
char *
HASHEnd(HASH_CTX *ctx, char *buf)
diff --git a/src/sha1.c b/src/sha1.c
index 4fa4f76..9520448 100644
--- a/src/sha1.c
+++ b/src/sha1.c
@@ -18,7 +18,9 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
+#endif
#include <string.h>
#include <sha1.h>
--
2.10.2
More information about the libbsd
mailing list