[master] a865812c0 vsha256: Insist that our byte order macros are defined

Nils Goroll nils.goroll at uplex.de
Mon Nov 18 14:08:03 UTC 2024


commit a865812c070bce1c4e6f5946862c994e5c57b9e9
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Nov 18 14:42:36 2024 +0100

    vsha256: Insist that our byte order macros are defined
    
    to avoid errors and confusion as documented in #4226

diff --git a/lib/libvarnish/vsha256.c b/lib/libvarnish/vsha256.c
index 6b6f756cb..7e55ec3ad 100644
--- a/lib/libvarnish/vsha256.c
+++ b/lib/libvarnish/vsha256.c
@@ -40,6 +40,14 @@
 #  define VBIG_ENDIAN	__DARWIN_BIG_ENDIAN
 #endif
 
+#ifndef VBYTE_ORDER
+# error VBYTE_ORDER not defined
+#endif
+#ifndef VBIG_ENDIAN
+# error VBIG_ENDIAN not defined
+#endif
+
+
 #include <sys/types.h>
 #include <stdint.h>
 #include <string.h>
@@ -50,7 +58,7 @@
 #include "vend.h"
 #include "vsha256.h"
 
-#if defined(VBYTE_ORDER) && VBYTE_ORDER == VBIG_ENDIAN
+#if VBYTE_ORDER == VBIG_ENDIAN
 
 /* Copy a vector of big-endian uint32_t into a vector of bytes */
 #define be32enc_vect(dst, src, len)	\


More information about the varnish-commit mailing list