[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] Use the gnulib byteswap and uname modules.
From: |
James Youngman |
Subject: |
[PATCH 3/8] Use the gnulib byteswap and uname modules. |
Date: |
Sun, 5 Jun 2011 01:11:52 +0100 |
* import-gnulib.config (modules): Add byteswap and uname.
* locate/word_io.c: Include byteswap.h. Don't #define bswap_32.
* find/util.c: sys/utsname.h no longer needs include guards since
gnulib always provides it.
* configure.ac: Don't check for sys/utsname.
---
ChangeLog | 7 +++++++
configure.ac | 2 --
find/util.c | 2 --
import-gnulib.config | 2 ++
locate/word_io.c | 6 +-----
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 624d848..033e612 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-06-04 James Youngman <address@hidden>
+ Use the gnulib byteswap and uname modules.
+ * import-gnulib.config (modules): Add byteswap and uname.
+ * locate/word_io.c: Include byteswap.h. Don't #define bswap_32.
+ * find/util.c: sys/utsname.h no longer needs include guards since
+ gnulib always provides it.
+ * configure.ac: Don't check for sys/utsname.
+
gnulib already defines O_CLOEXEC.
* lib/fdleak.c: gnulib's fcntl.h always defines O_CLOEXEC, so
don't define it here.
diff --git a/configure.ac b/configure.ac
index c46ffc2..6f7087e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,8 +120,6 @@ AC_SUBST([FINDLIBS])
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
-dnl find.c needs sys/utsname.h because it calls uname(2).
-AC_CHECK_HEADERS(sys/utsname.h)
dnl fdleak.c needs sys/resource.h because it calls getrlimit(2).
AC_CHECK_HEADERS(sys/resource.h)
AC_HEADER_MAJOR
diff --git a/find/util.c b/find/util.c
index 2542418..f639d0b 100644
--- a/find/util.c
+++ b/find/util.c
@@ -20,9 +20,7 @@
#include "defs.h"
#include <fcntl.h>
-#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
-#endif
#include <sys/time.h>
#include <sys/stat.h> /* for fstatat() */
#include <ctype.h>
diff --git a/import-gnulib.config b/import-gnulib.config
index e7f351d..3c37ed4 100644
--- a/import-gnulib.config
+++ b/import-gnulib.config
@@ -56,6 +56,7 @@ alloca
areadlinkat
argmatch
assert
+byteswap
c-strcasestr
c-strstr
canonicalize
@@ -138,6 +139,7 @@ sys_stat
sys_time
sys_wait
timespec
+uname
verify
version-etc
version-etc-fsf
diff --git a/locate/word_io.c b/locate/word_io.c
index e759fa6..50dab36 100644
--- a/locate/word_io.c
+++ b/locate/word_io.c
@@ -26,6 +26,7 @@
#include "error.h"
#include "quotearg.h"
+#include "byteswap.h"
#include "locatedb.h"
#if ENABLE_NLS
@@ -50,11 +51,6 @@
#endif
-/* Swap bytes in 32 bit value. This code is taken from glibc-2.3.3. */
-#define bswap_32(x) \
- ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
- (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
-
enum { WORDBYTES=4 };
static int
--
1.7.2.5
- [PATCH 1/8] Add internationalisation support to bigram but not regexprops., James Youngman, 2011/06/04
- [PATCH 6/8] Silence some false positives for sc_prohibit_always_true_header_tests., James Youngman, 2011/06/04
- [PATCH 8/8] Avoid some false positives for the sc_prohibit_doubled_word check., James Youngman, 2011/06/04
- [PATCH 3/8] Use the gnulib byteswap and uname modules.,
James Youngman <=
- [PATCH 2/8] gnulib already defines O_CLOEXEC., James Youngman, 2011/06/04
- [PATCH 4/8] Update xargs error message., James Youngman, 2011/06/04
- [PATCH 5/8] Prefer "cannot" to "can not"., James Youngman, 2011/06/04
- [PATCH 7/8] Include dirent.h uncontintionally (since gnulib provides it)., James Youngman, 2011/06/04