Date: Mon, 22 Jan 2018 01:50:10 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328237 - in head: include sys/sys Message-ID: <201801220150.w0M1oAUE058257@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon Jan 22 01:50:10 2018 New Revision: 328237 URL: https://svnweb.freebsd.org/changeset/base/328237 Log: Use the __alloc_size2 attribute where relevant. This follows the documented use in GCC. It is basically only relevant for calloc(3), reallocarray(3) and mallocarray(9). Suggested by: Mark Millard Reference: https://docs.freebsd.org/cgi/mid.cgi?9DE674C6-EAA3-4E8A-906F-446E74D82FC4 Modified: head/include/stdlib.h head/sys/sys/malloc.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Mon Jan 22 00:45:49 2018 (r328236) +++ head/include/stdlib.h Mon Jan 22 01:50:10 2018 (r328237) @@ -92,7 +92,7 @@ long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void * _Nonnull, const void *)); void *calloc(size_t, size_t) __malloc_like __result_use_check - __alloc_size(1) __alloc_size(2); + __alloc_size2(1, 2); div_t div(int, int) __pure2; _Noreturn void exit(int); void free(void *); @@ -302,8 +302,8 @@ void qsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); -void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) - __alloc_size(3); +void *reallocarray(void *, size_t, size_t) __result_use_check + __alloc_size2(2, 3); void *reallocf(void *, size_t) __result_use_check __alloc_size(2); int rpmatch(const char *); void setprogname(const char *); Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Mon Jan 22 00:45:49 2018 (r328236) +++ head/sys/sys/malloc.h Mon Jan 22 01:50:10 2018 (r328237) @@ -188,7 +188,7 @@ void *malloc_domain(unsigned long size, struct malloc_ __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_size(1) __alloc_size(2); + __alloc_size2(1, 2); void malloc_init(void *); int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801220150.w0M1oAUE058257>