Date: Wed, 24 Jan 2018 19:37:18 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328351 - in head: share/man/man9 sys/kern sys/sys Message-ID: <201801241937.w0OJbI8U017470@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Wed Jan 24 19:37:18 2018 New Revision: 328351 URL: https://svnweb.freebsd.org/changeset/base/328351 Log: malloc(9): Change nominal size to size_t to match standard C No functional change -- size_t matches unsigned long on all platforms. Reported by: bde Discussed with: jhb Sponsored by: Dell EMC Isilon Modified: head/share/man/man9/malloc.9 head/sys/kern/kern_malloc.c head/sys/sys/malloc.h Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Wed Jan 24 19:06:44 2018 (r328350) +++ head/share/man/man9/malloc.9 Wed Jan 24 19:37:18 2018 (r328351) @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd January 10, 2018 +.Dd January 24, 2018 .Dt MALLOC 9 .Os .Sh NAME @@ -44,15 +44,15 @@ .In sys/types.h .In sys/malloc.h .Ft void * -.Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" +.Fn malloc "size_t size" "struct malloc_type *type" "int flags" .Ft void * .Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Ft void .Fn free "void *addr" "struct malloc_type *type" .Ft void * -.Fn realloc "void *addr" "unsigned long size" "struct malloc_type *type" "int flags" +.Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" .Ft void * -.Fn reallocf "void *addr" "unsigned long size" "struct malloc_type *type" "int flags" +.Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags" .Fn MALLOC_DECLARE type .In sys/param.h .In sys/malloc.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Jan 24 19:06:44 2018 (r328350) +++ head/sys/kern/kern_malloc.c Wed Jan 24 19:37:18 2018 (r328351) @@ -518,7 +518,7 @@ malloc_dbg(caddr_t *vap, unsigned long *sizep, struct * the allocation fails. */ void * -malloc(unsigned long size, struct malloc_type *mtp, int flags) +malloc(size_t size, struct malloc_type *mtp, int flags) { int indx; struct malloc_type_internal *mtip; @@ -567,7 +567,7 @@ malloc(unsigned long size, struct malloc_type *mtp, in } void * -malloc_domain(unsigned long size, struct malloc_type *mtp, int domain, +malloc_domain(size_t size, struct malloc_type *mtp, int domain, int flags) { int indx; @@ -754,7 +754,7 @@ free_domain(void *addr, struct malloc_type *mtp) * realloc: change the size of a memory block */ void * -realloc(void *addr, unsigned long size, struct malloc_type *mtp, int flags) +realloc(void *addr, size_t size, struct malloc_type *mtp, int flags) { uma_slab_t slab; unsigned long alloc; @@ -815,7 +815,7 @@ realloc(void *addr, unsigned long size, struct malloc_ * reallocf: same as realloc() but free memory on failure. */ void * -reallocf(void *addr, unsigned long size, struct malloc_type *mtp, int flags) +reallocf(void *addr, size_t size, struct malloc_type *mtp, int flags) { void *mem; Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Wed Jan 24 19:06:44 2018 (r328350) +++ head/sys/sys/malloc.h Wed Jan 24 19:37:18 2018 (r328351) @@ -181,11 +181,10 @@ void *contigmalloc_domain(unsigned long size, struct m __malloc_like __result_use_check __alloc_size(1) __alloc_align(6); void free(void *addr, struct malloc_type *type); void free_domain(void *addr, struct malloc_type *type); -void *malloc(unsigned long size, struct malloc_type *type, int flags) - __malloc_like __result_use_check __alloc_size(1); -void *malloc_domain(unsigned long size, struct malloc_type *type, - int domain, int flags) - __malloc_like __result_use_check __alloc_size(1); +void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like + __result_use_check __alloc_size(1); +void *malloc_domain(size_t size, struct malloc_type *type, int domain, + int flags) __malloc_like __result_use_check __alloc_size(1); void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) __malloc_like __result_use_check __alloc_size2(1, 2); @@ -195,10 +194,10 @@ void malloc_type_allocated(struct malloc_type *type, u void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_uninit(void *); -void *realloc(void *addr, unsigned long size, struct malloc_type *type, - int flags) __result_use_check __alloc_size(2); -void *reallocf(void *addr, unsigned long size, struct malloc_type *type, - int flags) __result_use_check __alloc_size(2); +void *realloc(void *addr, size_t size, struct malloc_type *type, int flags) + __result_use_check __alloc_size(2); +void *reallocf(void *addr, size_t size, struct malloc_type *type, int flags) + __result_use_check __alloc_size(2); struct malloc_type *malloc_desc2type(const char *desc);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801241937.w0OJbI8U017470>