diff options
author | Marcus Müller <marcus@hostalia.de> | 2018-08-25 22:53:25 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-08-27 18:58:36 +0200 |
commit | 7985034ed4dc98ab5fe7366695f5abec75545914 (patch) | |
tree | 124259ad00863f904e13dda749106238bb29f1bf | |
parent | 0c024207b2ce3d10982e9d8912096afcfbdb925e (diff) |
Remove unused posix_memalign implementation
CMakeLists mentions it might have been useful on PowerPC once, but isn't
certain of utility anymore. Since it's been years: deleting this cruft.
-rw-r--r-- | gnuradio-runtime/lib/CMakeLists.txt | 8 | ||||
-rw-r--r-- | gnuradio-runtime/lib/posix_memalign.cc | 114 | ||||
-rw-r--r-- | gnuradio-runtime/lib/posix_memalign.h | 42 |
3 files changed, 0 insertions, 164 deletions
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt index eee34f01ee..c820c5f1e9 100644 --- a/gnuradio-runtime/lib/CMakeLists.txt +++ b/gnuradio-runtime/lib/CMakeLists.txt @@ -120,14 +120,6 @@ list(APPEND gnuradio_runtime_sources ${gnuradio_ctrlport_sources} ) -# PowerPC workaround for posix_memalign -# Might not be needed, but we'll keep it for now. -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - list(APPEND gnuradio_runtime_sources - ${CMAKE_CURRENT_SOURCE_DIR}/posix_memalign.cc - ) -endif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - list(APPEND gnuradio_runtime_libs gnuradio-pmt ${VOLK_LIBRARIES} diff --git a/gnuradio-runtime/lib/posix_memalign.cc b/gnuradio-runtime/lib/posix_memalign.cc deleted file mode 100644 index eb3bbe3e0f..0000000000 --- a/gnuradio-runtime/lib/posix_memalign.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "posix_memalign.h" - -#ifdef HAVE_MALLOC_H -// for Cygwin valloc () prototype -#include <malloc.h> -#endif - -#ifndef HAVE_POSIX_MEMALIGN - -/* emulate posix_memalign functionality, to some degree */ - -#include <errno.h> -#include "pagesize.h" - -int posix_memalign -(void **memptr, size_t alignment, size_t size) -{ - /* emulate posix_memalign functionality, to some degree */ - - /* make sure the return handle is valid; return "bad address" if not valid */ - if (memptr == 0) - return (EFAULT); - *memptr = (void*) 0; - - /* make sure 'alignment' is a power of 2 - * and multiple of sizeof (void*) - */ - - /* make sure 'alignment' is a multiple of sizeof (void*) */ - if ((alignment % sizeof (void*)) != 0) - return (EINVAL); - - /* make sure 'alignment' is a power of 2 */ - if ((alignment & (alignment - 1)) != 0) - return (EINVAL); - - /* good alignment */ - -#if (ALIGNED_MALLOC != 0) - - /* if 'malloc' is known to be aligned, and the desired 'alignment' - * matches is <= that provided by 'malloc', then use 'malloc'. This - * works on, e.g., Darwin for which malloc is 16-byte aligned. - */ - size_t am = (size_t) ALIGNED_MALLOC; - if (alignment <= am) { - /* make sure ALIGNED_MALLOC is a power of 2, to guarantee that the - * alignment is correct (since 'alignment' must be a power of 2). - */ - if ((am & (am - 1)) != 0) - return (EINVAL); - /* good malloc alignment */ - *memptr = malloc (size); - } - -#endif /* (ALIGNED_MALLOC != 0) */ -#ifdef HAVE_VALLOC - - if (*memptr == (void*) 0) { - /* try valloc if it exists */ - /* cheap and easy way to make sure alignment is met, so long as it - * is <= pagesize () */ - if (alignment <= (size_t) gr::pagesize ()) { - *memptr = valloc (size); - } - } - -#endif /* HAVE_VALLOC */ - -#if (ALIGNED_MALLOC == 0) && !defined (HAVE_VALLOC) - /* no posix_memalign, valloc, and malloc isn't known to be aligned - * (enough for the input arguments); no idea what to do. - */ - -#error gnuradio-runtime/lib/posix_memalign.cc: Cannot find a way to alloc aligned memory. - -#endif - - /* if the pointer wasn't allocated properly, return that there was - * not enough memory to allocate; otherwise, return OK (0). - */ - if (*memptr == (void*) 0) - return (ENOMEM); - else - return (0); -}; - -#endif /* ! HAVE_POSIX_MEMALIGN */ diff --git a/gnuradio-runtime/lib/posix_memalign.h b/gnuradio-runtime/lib/posix_memalign.h deleted file mode 100644 index ea79ced2ef..0000000000 --- a/gnuradio-runtime/lib/posix_memalign.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _POSIX_MEMALIGN_H_ -#define _POSIX_MEMALIGN_H_ - -#include <stdlib.h> - -#ifndef HAVE_POSIX_MEMALIGN - -#ifdef __cplusplus -extern "C" { -#endif - -extern int posix_memalign (void** memptr, size_t alignment, size_t size); - -#ifdef __cplusplus -}; -#endif - -#endif /* ! HAVE_POSIX_MEMALIGN */ - -#endif /* _POSIX_MEMALIGN_H_ */ |