aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Denisov2014-06-14 07:08:05 +0400
committerMike McQuaid2014-08-28 12:14:17 +0100
commit45bcde20cae1a0d0b15acb7326a33df61366c030 (patch)
tree8850ced87122fc4f07d0ae057ca065a58144d75c
parent3ad57cd9e555412df9f4b13d5314af2b8c46f078 (diff)
downloadhomebrew-45bcde20cae1a0d0b15acb7326a33df61366c030.tar.bz2
libmemcached: apply patch for >=10.9.
-rw-r--r--Library/Formula/libmemcached.rb199
1 files changed, 198 insertions, 1 deletions
diff --git a/Library/Formula/libmemcached.rb b/Library/Formula/libmemcached.rb
index 349e027d2..f524ad417 100644
--- a/Library/Formula/libmemcached.rb
+++ b/Library/Formula/libmemcached.rb
@@ -7,6 +7,7 @@ class Libmemcached < Formula
bottle do
cellar :any
+ revision 1
sha1 "abc6b08082ef18c8abb0df901063e88ee21fa82e" => :mavericks
sha1 "a4da2082b38e15cd86dffd3f3b3c5b691dee1f90" => :mountain_lion
sha1 "5029f4a7f05dd5f727b17617e49b424940c3def0" => :lion
@@ -20,7 +21,7 @@ class Libmemcached < Formula
depends_on "memcached"
end
- # https://bugs.launchpad.net/libmemcached/+bug/1284765
+ # https://bugs.launchpad.net/libmemcached/+bug/1245562
patch :DATA
def install
@@ -60,6 +61,106 @@ index 8bd0dbf..cdba743 100644
{
std::cerr << "No Servers provided" << std::endl;
exit(EXIT_FAILURE);
+diff --git a/example/byteorder.cc b/example/byteorder.cc
+index fdfa021..8c03d35 100644
+--- a/example/byteorder.cc
++++ b/example/byteorder.cc
+@@ -42,27 +42,59 @@
+ #include <example/byteorder.h>
+
+ /* Byte swap a 64-bit number. */
+-#ifndef swap64
+-static inline uint64_t swap64(uint64_t in)
+-{
+-#ifndef WORDS_BIGENDIAN
+- /* Little endian, flip the bytes around until someone makes a faster/better
++#if !defined(htonll) && !defined(ntohll)
++#if __BYTE_ORDER == __LITTLE_ENDIAN
++# if defined(__FreeBSD__)
++# include <sys/endian.h>
++# define htonll(x) bswap64(x)
++# define ntohll(x) bswap64(x)
++# elif defined(__APPLE__)
++# include <libkern/OSByteOrder.h>
++# define htonll(x) OSSwapInt64(x)
++# define ntohll(x) OSSwapInt64(x)
++# elif defined(__OpenBSD__)
++# include <sys/types.h>
++# define htonll(x) swap64(x)
++# define ntohll(x) swap64(x)
++# elif defined(__NetBSD__)
++# include <sys/types.h>
++# include <machine/bswap.h>
++# if defined(__BSWAP_RENAME) && !defined(__bswap_32)
++# define htonll(x) bswap64(x)
++# define ntohll(x) bswap64(x)
++# endif
++# elif defined(__sun) || defined(sun)
++# include <sys/byteorder.h>
++# define htonll(x) BSWAP_64(x)
++# define ntohll(x) BSWAP_64(x)
++# elif defined(_MSC_VER)
++# include <stdlib.h>
++# define htonll(x) _byteswap_uint64(x)
++# define ntohll(x) _byteswap_uint64(x)
++# else
++# include <byteswap.h>
++# ifndef bswap_64
++ /* Little endian, flip the bytes around until someone makes a faster/better
+ * way to do this. */
+- uint64_t rv= 0;
+- for (uint8_t x= 0; x < 8; x++)
+- {
+- rv= (rv << 8) | (in & 0xff);
+- in >>= 8;
+- }
+- return rv;
++ static inline uint64_t bswap_64(uint64_t in)
++ {
++ uint64_t rv= 0;
++ for (uint8_t x= 0; x < 8; x++)
++ {
++ rv= (rv << 8) | (in & 0xff);
++ in >>= 8;
++ }
++ return rv;
++ }
++# endif
++# define htonll(x) bswap_64(x)
++# define ntohll(x) bswap_64(x)
++# endif
+ #else
+- /* big-endian machines don't need byte swapping */
+- return in;
+-#endif // WORDS_BIGENDIAN
+-}
++# define htonll(x) (x)
++# define ntohll(x) (x)
++#endif
+ #endif
+-
+-#ifdef HAVE_HTONLL
+
+ uint64_t example_ntohll(uint64_t value)
+ {
+@@ -73,17 +105,3 @@ uint64_t example_htonll(uint64_t value)
+ {
+ return htonll(value);
+ }
+-
+-#else // HAVE_HTONLL
+-
+-uint64_t example_ntohll(uint64_t value)
+-{
+- return swap64(value);
+-}
+-
+-uint64_t example_htonll(uint64_t value)
+-{
+- return swap64(value);
+-}
+-
+-#endif // HAVE_HTONLL
diff --git a/libmemcached-1.0/memcached.h b/libmemcached-1.0/memcached.h
index bc16e73..dcee395 100644
--- a/libmemcached-1.0/memcached.h
@@ -76,3 +177,99 @@ index bc16e73..dcee395 100644
# include <cstddef>
# include <cstdlib>
#else
+diff --git a/libmemcached/byteorder.cc b/libmemcached/byteorder.cc
+index 9f11aa8..f167822 100644
+--- a/libmemcached/byteorder.cc
++++ b/libmemcached/byteorder.cc
+@@ -39,41 +39,66 @@
+ #include "libmemcached/byteorder.h"
+
+ /* Byte swap a 64-bit number. */
+-#ifndef swap64
+-static inline uint64_t swap64(uint64_t in)
+-{
+-#ifndef WORDS_BIGENDIAN
+- /* Little endian, flip the bytes around until someone makes a faster/better
++#if !defined(htonll) && !defined(ntohll)
++#if __BYTE_ORDER == __LITTLE_ENDIAN
++# if defined(__FreeBSD__)
++# include <sys/endian.h>
++# define htonll(x) bswap64(x)
++# define ntohll(x) bswap64(x)
++# elif defined(__APPLE__)
++# include <libkern/OSByteOrder.h>
++# define htonll(x) OSSwapInt64(x)
++# define ntohll(x) OSSwapInt64(x)
++# elif defined(__OpenBSD__)
++# include <sys/types.h>
++# define htonll(x) swap64(x)
++# define ntohll(x) swap64(x)
++# elif defined(__NetBSD__)
++# include <sys/types.h>
++# include <machine/bswap.h>
++# if defined(__BSWAP_RENAME) && !defined(__bswap_32)
++# define htonll(x) bswap64(x)
++# define ntohll(x) bswap64(x)
++# endif
++# elif defined(__sun) || defined(sun)
++# include <sys/byteorder.h>
++# define htonll(x) BSWAP_64(x)
++# define ntohll(x) BSWAP_64(x)
++# elif defined(_MSC_VER)
++# include <stdlib.h>
++# define htonll(x) _byteswap_uint64(x)
++# define ntohll(x) _byteswap_uint64(x)
++# else
++# include <byteswap.h>
++# ifndef bswap_64
++ /* Little endian, flip the bytes around until someone makes a faster/better
+ * way to do this. */
+- uint64_t rv= 0;
+- for (uint8_t x= 0; x < 8; ++x)
+- {
+- rv= (rv << 8) | (in & 0xff);
+- in >>= 8;
+- }
+- return rv;
++ static inline uint64_t bswap_64(uint64_t in)
++ {
++ uint64_t rv= 0;
++ for (uint8_t x= 0; x < 8; x++)
++ {
++ rv= (rv << 8) | (in & 0xff);
++ in >>= 8;
++ }
++ return rv;
++ }
++# endif
++# define htonll(x) bswap_64(x)
++# define ntohll(x) bswap_64(x)
++# endif
+ #else
+- /* big-endian machines don't need byte swapping */
+- return in;
+-#endif // WORDS_BIGENDIAN
+-}
++# define htonll(x) (x)
++# define ntohll(x) (x)
++#endif
+ #endif
+-
+
+ uint64_t memcached_ntohll(uint64_t value)
+ {
+-#ifdef HAVE_HTONLL
+ return ntohll(value);
+-#else
+- return swap64(value);
+-#endif
+ }
+
+ uint64_t memcached_htonll(uint64_t value)
+ {
+-#ifdef HAVE_HTONLL
+ return htonll(value);
+-#else
+- return swap64(value);
+-#endif
+ }