zalloc_malloc.c (223151) | zalloc_malloc.c (223905) |
---|---|
1/* 2 * This module derived from code donated to the FreeBSD Project by 3 * Matthew Dillon <dillon@backplane.com> 4 * 5 * Copyright (c) 1998 The FreeBSD Project 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/* 2 * This module derived from code donated to the FreeBSD Project by 3 * Matthew Dillon <dillon@backplane.com> 4 * 5 * Copyright (c) 1998 The FreeBSD Project 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/lib/libstand/zalloc_malloc.c 223151 2011-06-16 15:35:12Z avatar $"); | 31__FBSDID("$FreeBSD: head/lib/libstand/zalloc_malloc.c 223905 2011-07-10 07:25:34Z avatar $"); |
32 33/* 34 * MALLOC.C - malloc equivalent, runs on top of zalloc and uses sbrk 35 */ 36 37#include "zalloc_defs.h" 38 39static MemPool MallocPool; --- 81 unchanged lines hidden (view full) --- 121#endif 122 } 123} 124 125 126void * 127Calloc(size_t n1, size_t n2, const char *file, int line) 128{ | 32 33/* 34 * MALLOC.C - malloc equivalent, runs on top of zalloc and uses sbrk 35 */ 36 37#include "zalloc_defs.h" 38 39static MemPool MallocPool; --- 81 unchanged lines hidden (view full) --- 121#endif 122 } 123} 124 125 126void * 127Calloc(size_t n1, size_t n2, const char *file, int line) 128{ |
129 iaddr_t bytes = (iaddr_t)n1 * (iaddr_t)n2; | 129 uintptr_t bytes = (uintptr_t)n1 * (uintptr_t)n2; |
130 void *res; 131 132 if ((res = Malloc(bytes, file, line)) != NULL) { 133 bzero(res, bytes); 134#ifdef DMALLOCDEBUG 135 if (++MallocCount > MallocMax) 136 MallocMax = MallocCount; 137#endif --- 63 unchanged lines hidden --- | 130 void *res; 131 132 if ((res = Malloc(bytes, file, line)) != NULL) { 133 bzero(res, bytes); 134#ifdef DMALLOCDEBUG 135 if (++MallocCount > MallocMax) 136 MallocMax = MallocCount; 137#endif --- 63 unchanged lines hidden --- |