summaryrefslogtreecommitdiffstats
path: root/hivex/hivex.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-02-03 17:41:15 +0000
committerRichard Jones <rjones@redhat.com>2010-02-04 10:26:11 +0000
commite8ad7d2e1b1422680f9f862e7443de67328de135 (patch)
treee8aef6df864bc1a96a6bb212156a414b9bed45a8 /hivex/hivex.c
parent187651c138666d0555bc8ccdd129bb0f51caa72b (diff)
downloadlibguestfs-e8ad7d2e1b1422680f9f862e7443de67328de135.tar.gz
libguestfs-e8ad7d2e1b1422680f9f862e7443de67328de135.tar.xz
libguestfs-e8ad7d2e1b1422680f9f862e7443de67328de135.zip
Move htole*/le*toh macros into a separate header file.
This allows us to reuse these macros in hivexsh later.
Diffstat (limited to 'hivex/hivex.c')
-rw-r--r--hivex/hivex.c43
1 files changed, 2 insertions, 41 deletions
diff --git a/hivex/hivex.c b/hivex/hivex.c
index d2c450fe..4cf3ad99 100644
--- a/hivex/hivex.c
+++ b/hivex/hivex.c
@@ -1,5 +1,5 @@
/* hivex - Windows Registry "hive" extraction library.
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009-2010 Red Hat Inc.
* Derived from code by Petter Nordahl-Hagen under a compatible license:
* Copyright (c) 1997-2007 Petter Nordahl-Hagen.
* Derived from code by Markus Stephany under a compatible license:
@@ -33,12 +33,6 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <assert.h>
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#endif
-#ifdef HAVE_BYTESWAP_H
-#include <byteswap.h>
-#endif
#define STREQ(a,b) (strcmp((a),(b)) == 0)
#define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0)
@@ -50,41 +44,8 @@
//#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
//#define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0)
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#ifndef be32toh
-#define be32toh(x) __bswap_32 (x)
-#endif
-#ifndef be64toh
-#define be64toh(x) __bswap_64 (x)
-#endif
-#ifndef le16toh
-#define le16toh(x) (x)
-#endif
-#ifndef le32toh
-#define le32toh(x) (x)
-#endif
-#ifndef le64toh
-#define le64toh(x) (x)
-#endif
-#else
-#ifndef be32toh
-#define be32toh(x) (x)
-#endif
-#ifndef be64toh
-#define be64toh(x) (x)
-#endif
-#ifndef le16toh
-#define le16toh(x) __bswap_16 (x)
-#endif
-#ifndef le32toh
-#define le32toh(x) __bswap_32 (x)
-#endif
-#ifndef le64toh
-#define le64toh(x) __bswap_64 (x)
-#endif
-#endif
-
#include "hivex.h"
+#include "byte_conversions.h"
static char *windows_utf16_to_utf8 (/* const */ char *input, size_t len);