head 1.18; access; symbols MM_1_4_2:1.16 MM_1_4_1:1.16 MM_1_4_0:1.14 MM_1_3_1:1.13 MM_1_3_0:1.12 MM_1_2_2:1.12 MM_1_2_1:1.10 MM_1_2_0:1.10 MM_1_1_3:1.8 MM_1_1_2:1.8 MM_1_1_1:1.8 MM_1_1_0:1.8 MM_1_0_12:1.7 MM_1_0_11:1.7 MM_1_0_10:1.7 MM_1_0_9:1.7 MM_1_0_8:1.7 MM_1_0_7:1.7 MM_1_0_6:1.7 MM_1_0_5:1.7 MM_1_0_4:1.7 MM_1_0_3:1.7 MM_1_0_1:1.6 MM_1_0_0:1.5 MM_1_0b6:1.5 MM_1_0b5:1.4 MM_1_0b4:1.3 MM_1_0b3:1.3 MM_1_0b2plus:1.1.1.1 RSE:1.1.1; locks; strict; comment @ * @; 1.18 date 2007.01.01.18.29.19; author rse; state Exp; branches; next 1.17; commitid GSyun0edUBWuKP0s; 1.17 date 2007.01.01.18.26.34; author rse; state Exp; branches; next 1.16; commitid xbmVq17WhC8zJP0s; 1.16 date 2006.08.10.19.00.33; author rse; state Exp; branches; next 1.15; commitid zS8gipIRuG1bykIr; 1.15 date 2006.06.10.21.25.55; author rse; state Exp; branches; next 1.14; commitid MFCthRi9H63BjvAr; 1.14 date 2005.09.02.20.00.46; author rse; state Exp; branches; next 1.13; 1.13 date 2004.09.12.18.35.01; author rse; state Exp; branches; next 1.12; 1.12 date 2002.12.19.09.25.24; author rse; state Exp; branches; next 1.11; 1.11 date 2002.12.19.09.14.58; author rse; state Exp; branches; next 1.10; 1.10 date 2002.07.26.09.59.34; author rse; state Exp; branches; next 1.9; 1.9 date 2001.01.29.20.27.22; author rse; state Exp; branches; next 1.8; 1.8 date 2000.01.09.20.19.40; author rse; state Exp; branches; next 1.7; 1.7 date 99.05.15.11.45.22; author rse; state Exp; branches; next 1.6; 1.6 date 99.04.18.10.39.51; author rse; state Exp; branches; next 1.5; 1.5 date 99.03.18.14.47.38; author rse; state Exp; branches; next 1.4; 1.4 date 99.03.18.09.02.13; author rse; state Exp; branches; next 1.3; 1.3 date 99.03.15.13.25.48; author rse; state Exp; branches; next 1.2; 1.2 date 99.03.15.12.58.49; author rse; state Exp; branches; next 1.1; 1.1 date 99.03.15.11.12.50; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.03.15.11.12.50; author rse; state Exp; branches; next ; desc @@ 1.18 log @Fix sanity check on "mm_global" variable in MM_permission(). Submitted by: Michael Durket @ text @/* ==================================================================== * Copyright (c) 1999-2007 Ralf S. Engelschall * Copyright (c) 1999-2007 The OSSP Project * * 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. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by * Ralf S. Engelschall ." * * 4. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by * Ralf S. Engelschall ." * * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY * EXPRESSED 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 RALF S. ENGELSCHALL OR * ITS 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. * ==================================================================== */ /* ** ** mm_global.c -- Global Malloc-Replacement API ** */ #define MM_PRIVATE #include "mm.h" static MM *mm_global = NULL; int MM_create(size_t size, const char *file) { if (mm_global != NULL) return FALSE; if ((mm_global = mm_create(size, file)) == NULL) return FALSE; return TRUE; } int MM_permission(mode_t mode, uid_t owner, gid_t group) { if (mm_global == NULL) return -1; return mm_permission(mm_global, mode, owner, group); } void MM_reset(void) { if (mm_global == NULL) return; mm_reset(mm_global); return; } void MM_destroy(void) { if (mm_global == NULL) return; mm_destroy(mm_global); mm_global = NULL; return; } int MM_lock(mm_lock_mode mode) { if (mm_global == NULL) return FALSE; return mm_lock(mm_global, mode); } int MM_unlock(void) { if (mm_global == NULL) return FALSE; return mm_unlock(mm_global); } void *MM_malloc(size_t size) { if (mm_global == NULL) return NULL; return mm_malloc(mm_global, size); } void *MM_realloc(void *ptr, size_t size) { if (mm_global == NULL) return NULL; return mm_realloc(mm_global, ptr, size); } void MM_free(void *ptr) { if (mm_global == NULL) return; mm_free(mm_global, ptr); return; } void *MM_calloc(size_t number, size_t size) { if (mm_global == NULL) return NULL; return mm_calloc(mm_global, number, size); } char *MM_strdup(const char *str) { if (mm_global == NULL) return NULL; return mm_strdup(mm_global, str); } size_t MM_sizeof(const void *ptr) { if (mm_global == NULL) return -1; return mm_sizeof(mm_global, ptr); } size_t MM_maxsize(void) { return mm_maxsize(); } size_t MM_available(void) { if (mm_global == NULL) return -1; return mm_available(mm_global); } char *MM_error(void) { return mm_lib_error_get(); } /*EOF*/ @ 1.17 log @Updated all copyright messages for year 2007 @ text @d64 1 a64 1 if (mm_global != NULL) @ 1.16 log @bump copyright for year 2006 @ text @d2 2 a3 2 * Copyright (c) 1999-2006 Ralf S. Engelschall * Copyright (c) 1999-2006 The OSSP Project @ 1.15 log @Add new API function MM_reset() and mm_reset(). Submitted by: Neil Conway @ text @d2 2 a3 2 * Copyright (c) 1999-2005 Ralf S. Engelschall * Copyright (c) 1999-2005 The OSSP Project @ 1.14 log @adjust copyright year @ text @d69 8 @ 1.13 log @adjust year in copyright messages @ text @d2 2 a3 2 * Copyright (c) 1999-2004 Ralf S. Engelschall * Copyright (c) 1999-2004 The OSSP Project @ 1.12 log @Updated all copyright messages with forthcoming year 2003, added OSSP project as secondary copyright holder, added standard OSSP ASCII-art logo to documents, etc. @ text @d2 2 a3 2 * Copyright (c) 1999-2003 Ralf S. Engelschall * Copyright (c) 1999-2003 The OSSP Project @ 1.11 log @Stripped trailing whitespaces from all files in source tree. @ text @d2 2 a3 1 * Copyright (c) 1999-2002 Ralf S. Engelschall. All rights reserved. @ 1.10 log @bump copyright year @ text @d9 1 a9 1 * notice, this list of conditions and the following disclaimer. @ 1.9 log @*** empty log message *** @ text @d2 1 a2 1 * Copyright (c) 1999-2001 Ralf S. Engelschall. All rights reserved. @ 1.8 log @*** empty log message *** @ text @d2 1 a2 1 * Copyright (c) 1999-2000 Ralf S. Engelschall. All rights reserved. @ 1.7 log @*** empty log message *** @ text @d2 1 a2 1 * Copyright (c) 1999 Ralf S. Engelschall. All rights reserved. @ 1.6 log @*** empty log message *** @ text @d61 7 @ 1.5 log @*** empty log message *** @ text @d52 1 a52 1 int MM_create(size_t size, char *file) d120 1 a120 1 size_t MM_sizeof(void *ptr) @ 1.4 log @*** empty log message *** @ text @d52 1 a52 1 int MM_create(void) d56 1 a56 1 if ((mm_global = mm_create(0, NULL)) == NULL) @ 1.3 log @*** empty log message *** @ text @d127 5 @ 1.2 log @*** empty log message *** @ text @d70 1 a70 1 int MM_lock(unsigned int mode) @ 1.1 log @Initial revision @ text @d70 1 a70 1 int MM_lock(void) d74 1 a74 1 return mm_lock(mm_global); @ 1.1.1.1 log @Import into CVS @ text @@