From: Luka Perkov Date: Wed, 13 Apr 2011 22:07:14 +0000 (+0000) Subject: upgrade libtorrent and rtorrent X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=c914c415e97880e600c3a89f3d9380a80268dc5d;p=openwrt%2Fsvn-archive%2Fpackages.git upgrade libtorrent and rtorrent SVN-Revision: 26652 --- diff --git a/libs/libtorrent/Makefile b/libs/libtorrent/Makefile index 40b38371c..5bafdcabe 100644 --- a/libs/libtorrent/Makefile +++ b/libs/libtorrent/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2007-2010 OpenWrt.org +# Copyright (C) 2007-2011 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libtorrent -PKG_REV:=1189 +PKG_REV:=1209 PKG_VERSION:=0.12.6_r$(PKG_REV) -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=svn://rakshasa.no/libtorrent/trunk/libtorrent @@ -29,6 +29,7 @@ define Package/libtorrent TITLE:=Rakshasa's BitTorrent library URL:=http://libtorrent.rakshasa.no/ DEPENDS:=+libopenssl +libsigcxx @!LINUX_2_4 + MAINTAINER:=Luka Perkov endef define Package/libtorrent/description @@ -39,14 +40,9 @@ define Package/libtorrent/description the speed of the official client. endef -ifneq ($(CONFIG_GCC_VERSION_3_4)$(CONFIG_GCC_VERSION_4_1),) - TARGET_CPPFLAGS += -fno-strict-aliasing -endif - -TARGET_CPPFLAGS += -fno-inline +TARGET_CPPFLAGS += -fno-strict-aliasing -fno-inline TARGET_LDFLAGS += $(LIBGCC_S) -# XXX: rtorrent needs encryption (--enable-openssl) CONFIGURE_ARGS+= \ --enable-shared \ --enable-static \ diff --git a/libs/libtorrent/patches/100-fix_cross_compile.patch b/libs/libtorrent/patches/100-fix_cross_compile.patch index ab5bca19f..8f0fbb912 100644 --- a/libs/libtorrent/patches/100-fix_cross_compile.patch +++ b/libs/libtorrent/patches/100-fix_cross_compile.patch @@ -1,5 +1,7 @@ ---- a/configure.ac -+++ b/configure.ac +Index: libtorrent-0.12.6_r1209/configure.ac +=================================================================== +--- libtorrent-0.12.6_r1209.orig/configure.ac 2011-03-27 12:23:16.000000000 +0200 ++++ libtorrent-0.12.6_r1209/configure.ac 2011-04-13 16:33:17.487339738 +0200 @@ -17,7 +17,6 @@ AM_INIT_AUTOMAKE @@ -8,14 +10,16 @@ AC_DISABLE_STATIC AM_DISABLE_STATIC -@@ -117,5 +116,4 @@ +@@ -118,5 +117,4 @@ src/protocol/Makefile src/tracker/Makefile src/utils/Makefile - test/Makefile ]) ---- a/Makefile.am -+++ b/Makefile.am +Index: libtorrent-0.12.6_r1209/Makefile.am +=================================================================== +--- libtorrent-0.12.6_r1209.orig/Makefile.am 2010-03-01 20:04:58.000000000 +0100 ++++ libtorrent-0.12.6_r1209/Makefile.am 2011-04-13 16:33:17.487339738 +0200 @@ -1,4 +1,4 @@ -SUBDIRS = src test +SUBDIRS = src diff --git a/libs/libtorrent/patches/110-fix-no-posix_memalign.diff b/libs/libtorrent/patches/110-fix-no-posix_memalign.diff deleted file mode 100644 index d0c1e43f3..000000000 --- a/libs/libtorrent/patches/110-fix-no-posix_memalign.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- a/rak/allocators.h -+++ b/rak/allocators.h -@@ -74,17 +74,13 @@ public: - size_type max_size () const throw() { return std::numeric_limits::max() / sizeof(T); } - - pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); } -+ void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); } - -- static pointer alloc_size(size_type size) { -- pointer ptr = NULL; -- int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size); -- -- return ptr; -- } -+ static pointer alloc_size(size_type size); -+ static void dealloc_size(pointer p, size_type size); - - void construct (pointer p, const T& value) { new((void*)p)T(value); } - void destroy (pointer p) { p->~T(); } -- void deallocate (pointer p, size_type num) { free((void*)p); } - }; - - -@@ -98,6 +94,36 @@ bool operator!= (const cacheline_allocator&, const cacheline_allocator&) - return false; - } - -+template -+inline typename cacheline_allocator::pointer cacheline_allocator::alloc_size(size_type size) { -+ pointer ptr; -+ -+#if HAVE_POSIX_MEMALIGN -+ if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size)) -+ return NULL; -+#else -+ char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1); -+ if (org == NULL) -+ return NULL; -+ -+ ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1)); -+ -+ // store originally allocated pointer for later free() at the end of the allocated data -+ *(void**)((char*)ptr + size) = org; -+#endif -+ -+ return ptr; -+} -+ -+template -+inline void cacheline_allocator::dealloc_size(pointer p, size_type size) { -+#if HAVE_POSIX_MEMALIGN -+ free(p); -+#else -+ free(*(void**)((char*)p + size)); -+#endif -+} -+ - } - - // diff --git a/libs/libtorrent/patches/110-fix-no-posix_memalign.patch b/libs/libtorrent/patches/110-fix-no-posix_memalign.patch new file mode 100644 index 000000000..b99a0d14d --- /dev/null +++ b/libs/libtorrent/patches/110-fix-no-posix_memalign.patch @@ -0,0 +1,62 @@ +Index: libtorrent-0.12.6_r1209/rak/allocators.h +=================================================================== +--- libtorrent-0.12.6_r1209.orig/rak/allocators.h 2010-11-10 12:40:28.000000000 +0100 ++++ libtorrent-0.12.6_r1209/rak/allocators.h 2011-04-13 16:33:28.179339669 +0200 +@@ -74,17 +74,13 @@ + size_type max_size () const throw() { return std::numeric_limits::max() / sizeof(T); } + + pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); } ++ void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); } + +- static pointer alloc_size(size_type size) { +- pointer ptr = NULL; +- int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size); +- +- return ptr; +- } ++ static pointer alloc_size(size_type size); ++ static void dealloc_size(pointer p, size_type size); + + void construct (pointer p, const T& value) { new((void*)p)T(value); } + void destroy (pointer p) { p->~T(); } +- void deallocate (pointer p, size_type num) { free((void*)p); } + }; + + +@@ -98,6 +94,36 @@ + return false; + } + ++template ++inline typename cacheline_allocator::pointer cacheline_allocator::alloc_size(size_type size) { ++ pointer ptr; ++ ++#if HAVE_POSIX_MEMALIGN ++ if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size)) ++ return NULL; ++#else ++ char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1); ++ if (org == NULL) ++ return NULL; ++ ++ ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1)); ++ ++ // store originally allocated pointer for later free() at the end of the allocated data ++ *(void**)((char*)ptr + size) = org; ++#endif ++ ++ return ptr; ++} ++ ++template ++inline void cacheline_allocator::dealloc_size(pointer p, size_type size) { ++#if HAVE_POSIX_MEMALIGN ++ free(p); ++#else ++ free(*(void**)((char*)p + size)); ++#endif ++} ++ + } + + // diff --git a/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.diff b/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.diff deleted file mode 100644 index 1a4662703..000000000 --- a/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- a/src/net/socket_datagram.cc -+++ b/src/net/socket_datagram.cc -@@ -73,6 +73,23 @@ SocketDatagram::write_datagram(const voi - int r; - - if (sa != NULL) { -+#ifdef RAK_USE_INET6 -+ if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet) { -+ uint32_t addr32[4]; -+ sockaddr_in6 mapped_addr; -+ memset(&mapped_addr, 0, sizeof(mapped_addr)); -+ mapped_addr.sin6_family = AF_INET6; -+ addr32[0] = 0; -+ addr32[1] = 0; -+ addr32[2] = htonl(0xffff); -+ addr32[3] = sa->sa_inet()->address_n(); -+ memcpy(mapped_addr.sin6_addr.s6_addr, addr32, sizeof(uint32_t) * 4); -+ mapped_addr.sin6_port = sa->sa_inet()->port_n(); -+ r = ::sendto(m_fileDesc, buffer, length, 0, (sockaddr*)&mapped_addr, sizeof(mapped_addr)); -+ } else if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet6) { -+ r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet6()->c_sockaddr(), sizeof(rak::socket_address_inet6)); -+ } else -+#endif - r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet()->c_sockaddr(), sizeof(rak::socket_address_inet)); - } else { - r = ::send(m_fileDesc, buffer, length, 0); diff --git a/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch b/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch new file mode 100644 index 000000000..745f689f8 --- /dev/null +++ b/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch @@ -0,0 +1,28 @@ +Index: libtorrent-0.12.6_r1209/src/net/socket_datagram.cc +=================================================================== +--- libtorrent-0.12.6_r1209.orig/src/net/socket_datagram.cc 2008-07-05 14:13:12.000000000 +0200 ++++ libtorrent-0.12.6_r1209/src/net/socket_datagram.cc 2011-04-13 16:33:33.266840379 +0200 +@@ -73,6 +73,23 @@ + int r; + + if (sa != NULL) { ++#ifdef RAK_USE_INET6 ++ if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet) { ++ uint32_t addr32[4]; ++ sockaddr_in6 mapped_addr; ++ memset(&mapped_addr, 0, sizeof(mapped_addr)); ++ mapped_addr.sin6_family = AF_INET6; ++ addr32[0] = 0; ++ addr32[1] = 0; ++ addr32[2] = htonl(0xffff); ++ addr32[3] = sa->sa_inet()->address_n(); ++ memcpy(mapped_addr.sin6_addr.s6_addr, addr32, sizeof(uint32_t) * 4); ++ mapped_addr.sin6_port = sa->sa_inet()->port_n(); ++ r = ::sendto(m_fileDesc, buffer, length, 0, (sockaddr*)&mapped_addr, sizeof(mapped_addr)); ++ } else if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet6) { ++ r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet6()->c_sockaddr(), sizeof(rak::socket_address_inet6)); ++ } else ++#endif + r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet()->c_sockaddr(), sizeof(rak::socket_address_inet)); + } else { + r = ::send(m_fileDesc, buffer, length, 0); diff --git a/libs/libtorrent/patches/121-fix-socket_set-template.diff b/libs/libtorrent/patches/121-fix-socket_set-template.diff deleted file mode 100644 index 8fa83046f..000000000 --- a/libs/libtorrent/patches/121-fix-socket_set-template.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- a/src/net/socket_set.h -+++ b/src/net/socket_set.h -@@ -53,12 +53,12 @@ namespace torrent { - - // Propably should rename to EventSet... - --class SocketSet : private std::vector > { -+class SocketSet : private std::vector > { - public: - typedef uint32_t size_type; - -- typedef std::vector > base_type; -- typedef std::vector > Table; -+ typedef std::vector > base_type; -+ typedef std::vector > Table; - - static const size_type npos = static_cast(-1); - diff --git a/libs/libtorrent/patches/121-fix-socket_set-template.patch b/libs/libtorrent/patches/121-fix-socket_set-template.patch new file mode 100644 index 000000000..12ce9b2ab --- /dev/null +++ b/libs/libtorrent/patches/121-fix-socket_set-template.patch @@ -0,0 +1,20 @@ +Index: libtorrent-0.12.6_r1209/src/net/socket_set.h +=================================================================== +--- libtorrent-0.12.6_r1209.orig/src/net/socket_set.h 2011-02-12 13:20:09.000000000 +0100 ++++ libtorrent-0.12.6_r1209/src/net/socket_set.h 2011-04-13 16:33:38.567388959 +0200 +@@ -53,12 +53,12 @@ + + // Propably should rename to EventSet... + +-class SocketSet : private std::vector > { ++class SocketSet : private std::vector > { + public: + typedef uint32_t size_type; + +- typedef std::vector > base_type; +- typedef std::vector > Table; ++ typedef std::vector > base_type; ++ typedef std::vector > Table; + + static const size_type npos = static_cast(-1); + diff --git a/libs/libtorrent/patches/122-fix-uintptr_t-use.patch b/libs/libtorrent/patches/122-fix-uintptr_t-use.patch index ce19e0158..8d2500dd9 100644 --- a/libs/libtorrent/patches/122-fix-uintptr_t-use.patch +++ b/libs/libtorrent/patches/122-fix-uintptr_t-use.patch @@ -1,13 +1,7 @@ -fix the following build error on octeon & ppc - -In file included from ../../rak/priority_queue_default.h:41, - from ./../dht/dht_router.h:40, - from tracker_dht.cc:42: -../../rak/allocators.h: In static member function 'static T* rak::cacheline_allocator::alloc_size(size_t)': -../../rak/allocators.h:109: error: 'uintptr_t' was not declared in this scope - ---- a/rak/allocators.h -+++ b/rak/allocators.h +Index: libtorrent-0.12.6_r1209/rak/allocators.h +=================================================================== +--- libtorrent-0.12.6_r1209.orig/rak/allocators.h 2011-04-13 16:33:28.179339669 +0200 ++++ libtorrent-0.12.6_r1209/rak/allocators.h 2011-04-13 16:33:48.454840573 +0200 @@ -41,6 +41,7 @@ #include diff --git a/net/rtorrent/Makefile b/net/rtorrent/Makefile index 3a0804b1e..969b0e99f 100644 --- a/net/rtorrent/Makefile +++ b/net/rtorrent/Makefile @@ -1,17 +1,16 @@ # -# Copyright (C) 2007-2010 OpenWrt.org +# Copyright (C) 2007-2011 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # -# include $(TOPDIR)/rules.mk PKG_NAME:=rtorrent -PKG_REV:=1189 +PKG_REV:=1209 PKG_VERSION:=0.8.6_r$(PKG_REV) -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=svn://rakshasa.no/libtorrent/trunk/rtorrent @@ -31,6 +30,7 @@ define Package/rtorrent TITLE:=BitTorrent client for ncurses URL:=http://libtorrent.rakshasa.no/ DEPENDS:=+libcurl +libtorrent +libncurses +libsigcxx +xmlrpc-c-server +libpthread + MAINTAINER:=Luka Perkov endef define Package/rtorrent/description @@ -40,10 +40,7 @@ define Package/rtorrent/description based clients in an ncurses client. endef -ifneq ($(CONFIG_GCC_VERSION_3_4)$(CONFIG_GCC_VERSION_4_1),) -TARGET_CPPFLAGS += -fno-strict-aliasing -endif - +TARGET_CPPFLAGS += -fno-strict-aliasing -fno-inline TARGET_LDFLAGS += -lpthread -Wl,-rpath-link=$(STAGING_DIR)/usr/lib CONFIGURE_ARGS+= \ @@ -53,7 +50,7 @@ CONFIGURE_ARGS+= \ --with-xmlrpc-c define Build/Configure - (cd $(PKG_BUILD_DIR); ./autogen.sh ); + ( cd $(PKG_BUILD_DIR); ./autogen.sh ); $(call Build/Configure/Default) endef diff --git a/net/rtorrent/patches/100-fix_cross_compile.patch b/net/rtorrent/patches/100-fix_cross_compile.patch index 00bd91eb2..2ad192d85 100644 --- a/net/rtorrent/patches/100-fix_cross_compile.patch +++ b/net/rtorrent/patches/100-fix_cross_compile.patch @@ -1,5 +1,7 @@ ---- a/configure.ac -+++ b/configure.ac +Index: rtorrent-0.8.6_r1209/configure.ac +=================================================================== +--- rtorrent-0.8.6_r1209.orig/configure.ac 2010-10-05 05:36:14.000000000 +0200 ++++ rtorrent-0.8.6_r1209/configure.ac 2011-04-13 16:29:48.619340344 +0200 @@ -2,7 +2,6 @@ AM_INIT_AUTOMAKE @@ -14,8 +16,10 @@ src/utils/Makefile - test/Makefile ]) ---- a/Makefile.am -+++ b/Makefile.am +Index: rtorrent-0.8.6_r1209/Makefile.am +=================================================================== +--- rtorrent-0.8.6_r1209.orig/Makefile.am 2010-03-19 10:33:25.000000000 +0100 ++++ rtorrent-0.8.6_r1209/Makefile.am 2011-04-13 16:29:48.619340344 +0200 @@ -1,7 +1,4 @@ -SUBDIRS = \ - doc \ @@ -25,9 +29,11 @@ EXTRA_DIST= \ autogen.sh \ ---- a/scripts/common.m4 -+++ b/scripts/common.m4 -@@ -209,7 +209,7 @@ dnl Need to fix this so that it uses t +Index: rtorrent-0.8.6_r1209/scripts/common.m4 +=================================================================== +--- rtorrent-0.8.6_r1209.orig/scripts/common.m4 2009-12-19 22:36:44.000000000 +0100 ++++ rtorrent-0.8.6_r1209/scripts/common.m4 2011-04-13 16:29:48.619340344 +0200 +@@ -209,7 +209,7 @@ AC_DEFUN([TORRENT_CHECK_EXECINFO], [ AC_MSG_CHECKING(for execinfo.h) diff --git a/net/rtorrent/patches/110-fix-no-posix_memalign.diff b/net/rtorrent/patches/110-fix-no-posix_memalign.diff deleted file mode 100644 index e4d374559..000000000 --- a/net/rtorrent/patches/110-fix-no-posix_memalign.diff +++ /dev/null @@ -1,70 +0,0 @@ -diff --git a/rak/allocators.h b/rak/allocators.h -index 0a1b711..2d7b98e 100644 ---- a/rak/allocators.h -+++ b/rak/allocators.h -@@ -42,6 +42,7 @@ - #include - #include - #include -+#include - #include - - namespace rak { -@@ -74,17 +75,13 @@ public: - size_type max_size () const throw() { return std::numeric_limits::max() / sizeof(T); } - - pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); } -+ void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); } - -- static pointer alloc_size(size_type size) { -- pointer ptr = NULL; -- int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size); -- -- return ptr; -- } -+ static pointer alloc_size(size_type size); -+ static void dealloc_size(pointer p, size_type size); - - void construct (pointer p, const T& value) { new((void*)p)T(value); } - void destroy (pointer p) { p->~T(); } -- void deallocate (pointer p, size_type num) { free((void*)p); } - }; - - -@@ -98,6 +95,36 @@ bool operator!= (const cacheline_allocator&, const cacheline_allocator&) - return false; - } - -+template -+inline typename cacheline_allocator::pointer cacheline_allocator::alloc_size(size_type size) { -+ pointer ptr; -+ -+#if HAVE_POSIX_MEMALIGN -+ if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size)) -+ return NULL; -+#else -+ char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1); -+ if (org == NULL) -+ return NULL; -+ -+ ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1)); -+ -+ // store originally allocated pointer for later free() at the end of the allocated data -+ *(void**)((char*)ptr + size) = org; -+#endif -+ -+ return ptr; -+} -+ -+template -+inline void cacheline_allocator::dealloc_size(pointer p, size_type size) { -+#if HAVE_POSIX_MEMALIGN -+ free(p); -+#else -+ free(*(void**)((char*)p + size)); -+#endif -+} -+ - } - - // diff --git a/net/rtorrent/patches/110-fix-no-posix_memalign.patch b/net/rtorrent/patches/110-fix-no-posix_memalign.patch new file mode 100644 index 000000000..baf34299f --- /dev/null +++ b/net/rtorrent/patches/110-fix-no-posix_memalign.patch @@ -0,0 +1,70 @@ +Index: rtorrent-0.8.6_r1209/rak/allocators.h +=================================================================== +--- rtorrent-0.8.6_r1209.orig/rak/allocators.h 2010-11-10 12:40:28.000000000 +0100 ++++ rtorrent-0.8.6_r1209/rak/allocators.h 2011-04-13 16:30:02.370840196 +0200 +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include + + namespace rak { +@@ -74,17 +75,13 @@ + size_type max_size () const throw() { return std::numeric_limits::max() / sizeof(T); } + + pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); } ++ void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); } + +- static pointer alloc_size(size_type size) { +- pointer ptr = NULL; +- int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size); +- +- return ptr; +- } ++ static pointer alloc_size(size_type size); ++ static void dealloc_size(pointer p, size_type size); + + void construct (pointer p, const T& value) { new((void*)p)T(value); } + void destroy (pointer p) { p->~T(); } +- void deallocate (pointer p, size_type num) { free((void*)p); } + }; + + +@@ -98,6 +95,36 @@ + return false; + } + ++template ++inline typename cacheline_allocator::pointer cacheline_allocator::alloc_size(size_type size) { ++ pointer ptr; ++ ++#if HAVE_POSIX_MEMALIGN ++ if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size)) ++ return NULL; ++#else ++ char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1); ++ if (org == NULL) ++ return NULL; ++ ++ ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1)); ++ ++ // store originally allocated pointer for later free() at the end of the allocated data ++ *(void**)((char*)ptr + size) = org; ++#endif ++ ++ return ptr; ++} ++ ++template ++inline void cacheline_allocator::dealloc_size(pointer p, size_type size) { ++#if HAVE_POSIX_MEMALIGN ++ free(p); ++#else ++ free(*(void**)((char*)p + size)); ++#endif ++} ++ + } + + //