From 2a5e85b04078e132f04aa78a9a2bac68183d600f Mon Sep 17 00:00:00 2001 From: mazze Date: Fri, 18 May 2012 15:26:50 +0000 Subject: [PATCH] No need for special malloc(). Removed Fredrik from the list of copyright holders as we now have only original bz2, extended by our library environment. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@44834 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/bz2/bz2_au.conf | 2 +- workbench/libs/bz2/init-aros.c | 13 +------- workbench/libs/bz2/malloc.c | 72 ---------------------------------------- workbench/libs/bz2/mmakefile.src | 2 +- workbench/libs/bz2/semaphores.c | 41 ----------------------- 5 files changed, 3 insertions(+), 127 deletions(-) delete mode 100755 workbench/libs/bz2/malloc.c delete mode 100644 workbench/libs/bz2/semaphores.c diff --git a/workbench/libs/bz2/bz2_au.conf b/workbench/libs/bz2/bz2_au.conf index 78d64b7af2..2cf130bcf1 100644 --- a/workbench/libs/bz2/bz2_au.conf +++ b/workbench/libs/bz2/bz2_au.conf @@ -4,7 +4,7 @@ libbase BZ2Base libbasetype struct BZ2Base version 3.0 date 16.05.2012 -copyright Copyright (C) 1996-2010 Julian R Seward, 2007-2012 Fredrik Wikstrom, 2012 The AROS Development Team +copyright Copyright (C) 1996-2010 Julian R Seward, 2012 The AROS Development Team options pertaskbase ##end config diff --git a/workbench/libs/bz2/init-aros.c b/workbench/libs/bz2/init-aros.c index 6842354a34..eff9557701 100644 --- a/workbench/libs/bz2/init-aros.c +++ b/workbench/libs/bz2/init-aros.c @@ -48,11 +48,7 @@ static int InitFunc(LIBBASETYPEPTR LIBBASE) aroscbase_offset = offsetof(LIBBASETYPE, _aroscbase); - if (malloc_init()) - { - return TRUE; - } - return FALSE; + return TRUE; } static int OpenFunc(LIBBASETYPEPTR LIBBASE) @@ -75,13 +71,6 @@ static int CloseFunc(LIBBASETYPEPTR LIBBASE) return TRUE; } -static int ExpungeFunc(LIBBASETYPEPTR LIBBASE) -{ - malloc_exit(); - return TRUE; -} - ADD2INITLIB(InitFunc, 0); ADD2OPENLIB(OpenFunc, 0); ADD2CLOSELIB(CloseFunc, 0); -ADD2EXPUNGELIB(ExpungeFunc, 0); diff --git a/workbench/libs/bz2/malloc.c b/workbench/libs/bz2/malloc.c deleted file mode 100755 index 68edbfd93f..0000000000 --- a/workbench/libs/bz2/malloc.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -** POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include -#include "support.h" - -#define BASE_PTR(ptr) ((void *)((size_t *)ptr - 1)) -#define ALLOC_SIZE(ptr) (*((size_t *)ptr - 1)) - -static struct SignalSemaphore *LibPoolSemaphore; -static APTR LibPool; - -int malloc_init(void) { - LibPoolSemaphore = CreateSemaphore(); - if (LibPoolSemaphore) { - LibPool = CreatePool(MEMF_ANY, 4096, 1024); - if (LibPool) { - return TRUE; - } - DeleteSemaphore(LibPoolSemaphore); - } - return FALSE; -} - -void malloc_exit(void) { - DeletePool(LibPool); - DeleteSemaphore(LibPoolSemaphore); -} - -void *malloc(size_t size) { - size_t *ptr; - ObtainSemaphore(LibPoolSemaphore); - ptr = AllocPooled(LibPool, sizeof(size_t) + size); - ReleaseSemaphore(LibPoolSemaphore); - if (ptr) { - *ptr++ = size; - } - return ptr; -} - -void free(void *ptr) { - if (ptr) { - ObtainSemaphore(LibPoolSemaphore); - FreePooled(LibPool, BASE_PTR(ptr), sizeof(size_t) + ALLOC_SIZE(ptr)); - ReleaseSemaphore(LibPoolSemaphore); - } -} diff --git a/workbench/libs/bz2/mmakefile.src b/workbench/libs/bz2/mmakefile.src index c999b31ef0..a6124b2efb 100644 --- a/workbench/libs/bz2/mmakefile.src +++ b/workbench/libs/bz2/mmakefile.src @@ -7,7 +7,7 @@ include $(TOP)/config/make.cfg #MM- workbench-libs-bz2 : linklibs FILES := init-aros blocksort huffman crctable randtable \ - compress decompress bzlib malloc semaphores + compress decompress bzlib USER_CFLAGS := diff --git a/workbench/libs/bz2/semaphores.c b/workbench/libs/bz2/semaphores.c deleted file mode 100644 index f1dd4e2094..0000000000 --- a/workbench/libs/bz2/semaphores.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -** POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "support.h" -#include - -struct SignalSemaphore *CreateSemaphore (void) { - struct SignalSemaphore *semaphore; - semaphore = AllocVec(sizeof(*semaphore), MEMF_CLEAR); - if (semaphore) { - InitSemaphore(semaphore); - } - return semaphore; -} - -void DeleteSemaphore (struct SignalSemaphore *semaphore) { - FreeVec(semaphore); -} -- 2.11.4.GIT