summaryrefslogtreecommitdiff
path: root/networking/udhcp/files.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-10-18 11:40:26 +0200
committerDenys Vlasenko2010-10-18 11:40:26 +0200
commit9ff50b869780aba131dc9b542ccd0f1a3959e920 (patch)
treea1f65f2a5f8c3aa1d6f51bc15c734f2b3ae46ead /networking/udhcp/files.c
parentb102e12253078e8c0ebdeeb5e1893ea6a025a700 (diff)
downloadbusybox-9ff50b869780aba131dc9b542ccd0f1a3959e920.zip
busybox-9ff50b869780aba131dc9b542ccd0f1a3959e920.tar.gz
*: deinline SWAP_xE64 on 32-bit CPUs. Wins !90 bytes both on 32 and 64 bits
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'networking/udhcp/files.c')
-rw-r--r--networking/udhcp/files.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 68b2085..49bcafb 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -11,16 +11,6 @@
#include "common.h"
#include "dhcpd.h"
-#if BB_LITTLE_ENDIAN
-static inline uint64_t hton64(uint64_t v)
-{
- return SWAP_BE64(v);
-}
-#else
-#define hton64(v) (v)
-#endif
-#define ntoh64(v) hton64(v)
-
/* on these functions, make sure your datatype matches */
static int FAST_FUNC read_str(const char *line, void *arg)
{
@@ -140,7 +130,7 @@ void FAST_FUNC write_leases(void)
curr = written_at = time(NULL);
- written_at = hton64(written_at);
+ written_at = SWAP_BE64(written_at);
full_write(fd, &written_at, sizeof(written_at));
for (i = 0; i < server_config.max_leases; i++) {
@@ -190,7 +180,7 @@ void FAST_FUNC read_leases(const char *file)
if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at))
goto ret;
- written_at = ntoh64(written_at);
+ written_at = SWAP_BE64(written_at);
time_passed = time(NULL) - written_at;
/* Strange written_at, or lease file from old version of udhcpd