Search
j0ke.net Open Build Service
>
Projects
>
internetx
:
1351100200
:
1002131200
>
memcached
> memcached-use-endian_h__1.4.36.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File memcached-use-endian_h__1.4.36.patch of Package memcached
Index: util.c =================================================================== --- util.c.orig +++ util.c @@ -115,30 +115,3 @@ void vperror(const char *fmt, ...) { perror(buf); } -#ifndef HAVE_HTONLL -static uint64_t mc_swap64(uint64_t in) { -#ifdef ENDIAN_LITTLE - /* Little endian, flip the bytes around until someone makes a faster/better - * way to do this. */ - int64_t rv = 0; - int i = 0; - for(i = 0; i<8; i++) { - rv = (rv << 8) | (in & 0xff); - in >>= 8; - } - return rv; -#else - /* big-endian machines don't need byte swapping */ - return in; -#endif -} - -uint64_t ntohll(uint64_t val) { - return mc_swap64(val); -} - -uint64_t htonll(uint64_t val) { - return mc_swap64(val); -} -#endif - --- util.h.orig 2017-02-26 21:09:58.000000000 +0100 +++ util.h 2017-05-05 08:59:26.240907964 +0200 @@ -11,16 +11,17 @@ * * returns true if conversion succeeded. */ + +#include <endian.h> + bool safe_strtoull(const char *str, uint64_t *out); bool safe_strtoll(const char *str, int64_t *out); bool safe_strtoul(const char *str, uint32_t *out); bool safe_strtol(const char *str, int32_t *out); bool safe_strtod(const char *str, double *out); -#ifndef HAVE_HTONLL -extern uint64_t htonll(uint64_t); -extern uint64_t ntohll(uint64_t); -#endif +#define htonll(x) htobe64(x) +#define ntohll(x) be64toh(x) #ifdef __GCC # define __gcc_attribute__ __attribute__