Use the host compiler for build tool c-ify.
[darkstat-debian] / db.c
diff --git a/db.c b/db.c
index 5a82d90..201d110 100644 (file)
--- a/db.c
+++ b/db.c
@@ -1,7 +1,7 @@
 /* darkstat 3
  *
  * db.c: load and save in-memory database from/to file
- * copyright (c) 2007-2011 Ben Stewart, Emil Mikulic.
+ * copyright (c) 2007-2012 Ben Stewart, Emil Mikulic.
  *
  * You may use, modify and redistribute this file under the terms of the
  * GNU General Public License version 2. (see COPYING.GPL)
@@ -16,7 +16,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "cdefs.h"
 #include "err.h"
 #include "hosts_db.h"
 #include "graph_db.h"
@@ -27,9 +26,7 @@ static const unsigned char export_tag_hosts_ver1[] = {0xDA, 'H', 'S', 0x01};
 static const unsigned char export_tag_graph_ver1[] = {0xDA, 'G', 'R', 0x01};
 
 #ifndef swap64
-static inline uint64_t
-swap64(uint64_t _x)
-{
+static uint64_t swap64(uint64_t _x) {
    /* this is __bswap64 from:
     * $FreeBSD: src/sys/i386/include/endian.h,v 1.41$
     */
@@ -40,17 +37,12 @@ swap64(uint64_t _x)
 }
 #endif
 
-uint64_t
-hton64(const uint64_t ho)
-{
-   if (ntohs(0x1234) == 0x1234) return ho;
-   else return swap64(ho);
-}
-
-uint64_t
-ntoh64(const uint64_t no)
-{
-   return hton64(no);
+#define ntoh64 hton64
+static uint64_t hton64(const uint64_t ho) {
+   if (ntohs(0x1234) == 0x1234)
+      return ho;
+   else
+      return swap64(ho);
 }
 
 void