Make sure at compile-time that `OBJCODE_COOKIE' has the right size.
authorLudovic Courtès <ludo@gnu.org>
Tue, 14 Jul 2009 23:03:35 +0000 (01:03 +0200)
committerLudovic Courtès <ludo@gnu.org>
Tue, 14 Jul 2009 23:03:35 +0000 (01:03 +0200)
* libguile/objcodes.c: Use `verify' to assert that the size of
  `OBJCODE_COOKIE' is a multiple of 8.

libguile/objcodes.c

index d5d6695..c758e93 100644 (file)
@@ -28,6 +28,8 @@
 #include <sys/types.h>
 #include <assert.h>
 
+#include <verify.h>
+
 #include "_scm.h"
 #include "vm-bootstrap.h"
 #include "programs.h"
 /* The word size marker in objcode.  */
 #define OBJCODE_WORD_SIZE  OBJCODE_STRINGIFY (SIZEOF_VOID_P)
 
-/* nb, the length of the header should be a multiple of 8 bytes */
+/* The objcode magic header.  */
 #define OBJCODE_COOKIE                                         \
   "GOOF-0.6-" OBJCODE_ENDIANNESS "-" OBJCODE_WORD_SIZE "---"
 
+/* The length of the header must be a multiple of 8 bytes.  */
+verify ((sizeof (OBJCODE_COOKIE) & 7) != 0);
+
+
 \f
 /*
  * Objcode type