Explorar o código

libcompat: Define offsetof only if the system does not have it

Due to <compat.h> being included first, offsetof was being defined
always to the local version.
Guillem Jover %!s(int64=17) %!d(string=hai) anos
pai
achega
55eb6f3163
Modificáronse 2 ficheiros con 3 adicións e 2 borrados
  1. 1 0
      configure.ac
  2. 2 2
      lib/compat/compat.h

+ 1 - 0
configure.ac

@@ -97,6 +97,7 @@ DPKG_C_ATTRIBUTE
 # Checks for library functions.
 DPKG_FUNC_VA_COPY
 DPKG_FUNC_C99_SNPRINTF
+DPKG_CHECK_DECL([offsetof], [stddef.h])
 DPKG_CHECK_DECL([WCOREDUMP], [sys/wait.h])
 DPKG_CHECK_COMPAT_FUNCS([getopt getopt_long obstack_free \
                          strnlen strerror strsignal \

+ 2 - 2
lib/compat/compat.h

@@ -3,7 +3,7 @@
  * compat.h - system compatibility declarations
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2008 Guillem Jover <guillem@debian.org>
+ * Copyright © 2008, 2009 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as
@@ -27,7 +27,7 @@
 extern "C" {
 #endif
 
-#ifndef offsetof
+#ifndef HAVE_OFFSETOF
 #define offsetof(st, m) ((size_t)&((st *)NULL)->m)
 #endif