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
This commit is contained in:
Conrad Meyer 2018-01-24 19:37:18 +00:00
parent b12a7532e3
commit bd555da94b
3 changed files with 16 additions and 17 deletions

View File

@ -29,7 +29,7 @@
.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd January 10, 2018 .Dd January 24, 2018
.Dt MALLOC 9 .Dt MALLOC 9
.Os .Os
.Sh NAME .Sh NAME
@ -44,15 +44,15 @@
.In sys/types.h .In sys/types.h
.In sys/malloc.h .In sys/malloc.h
.Ft void * .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 * .Ft void *
.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags"
.Ft void .Ft void
.Fn free "void *addr" "struct malloc_type *type" .Fn free "void *addr" "struct malloc_type *type"
.Ft void * .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 * .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 .Fn MALLOC_DECLARE type
.In sys/param.h .In sys/param.h
.In sys/malloc.h .In sys/malloc.h

View File

@ -518,7 +518,7 @@ malloc_dbg(caddr_t *vap, unsigned long *sizep, struct malloc_type *mtp,
* the allocation fails. * the allocation fails.
*/ */
void * void *
malloc(unsigned long size, struct malloc_type *mtp, int flags) malloc(size_t size, struct malloc_type *mtp, int flags)
{ {
int indx; int indx;
struct malloc_type_internal *mtip; struct malloc_type_internal *mtip;
@ -567,7 +567,7 @@ malloc(unsigned long size, struct malloc_type *mtp, int flags)
} }
void * 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 flags)
{ {
int indx; int indx;
@ -754,7 +754,7 @@ free_domain(void *addr, struct malloc_type *mtp)
* realloc: change the size of a memory block * realloc: change the size of a memory block
*/ */
void * 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; uma_slab_t slab;
unsigned long alloc; unsigned long alloc;
@ -815,7 +815,7 @@ realloc(void *addr, unsigned long size, struct malloc_type *mtp, int flags)
* reallocf: same as realloc() but free memory on failure. * reallocf: same as realloc() but free memory on failure.
*/ */
void * 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; void *mem;

View File

@ -181,11 +181,10 @@ void *contigmalloc_domain(unsigned long size, struct malloc_type *type,
__malloc_like __result_use_check __alloc_size(1) __alloc_align(6); __malloc_like __result_use_check __alloc_size(1) __alloc_align(6);
void free(void *addr, struct malloc_type *type); void free(void *addr, struct malloc_type *type);
void free_domain(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) void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like
__malloc_like __result_use_check __alloc_size(1); __result_use_check __alloc_size(1);
void *malloc_domain(unsigned long size, struct malloc_type *type, void *malloc_domain(size_t size, struct malloc_type *type, int domain,
int domain, int flags) int flags) __malloc_like __result_use_check __alloc_size(1);
__malloc_like __result_use_check __alloc_size(1);
void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type,
int flags) __malloc_like __result_use_check int flags) __malloc_like __result_use_check
__alloc_size2(1, 2); __alloc_size2(1, 2);
@ -195,10 +194,10 @@ void malloc_type_allocated(struct malloc_type *type, unsigned long size);
void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_freed(struct malloc_type *type, unsigned long size);
void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_type_list(malloc_type_list_func_t *, void *);
void malloc_uninit(void *); void malloc_uninit(void *);
void *realloc(void *addr, unsigned long size, struct malloc_type *type, void *realloc(void *addr, size_t size, struct malloc_type *type, int flags)
int flags) __result_use_check __alloc_size(2); __result_use_check __alloc_size(2);
void *reallocf(void *addr, unsigned long size, struct malloc_type *type, void *reallocf(void *addr, size_t size, struct malloc_type *type, int flags)
int flags) __result_use_check __alloc_size(2); __result_use_check __alloc_size(2);
struct malloc_type *malloc_desc2type(const char *desc); struct malloc_type *malloc_desc2type(const char *desc);