Module Name:    src
Committed By:   riastradh
Date:           Fri Oct 11 18:43:22 UTC 2024

Modified Files:
        src/include: stdlib.h

Log Message:
stdlib.h: Expose reallocarray only for POSIX 2024 or NetBSD/OpenBSD.

reallocarray(3) is new in POSIX 2024, so it should not be exposed if
you ask for an older POSIX standard like _POSIX_C_SOURCE=200809L.

PR standards/58741


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/include/stdlib.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/stdlib.h
diff -u src/include/stdlib.h:1.126 src/include/stdlib.h:1.127
--- src/include/stdlib.h:1.126	Mon Sep  9 15:15:24 2024
+++ src/include/stdlib.h	Fri Oct 11 18:43:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdlib.h,v 1.126 2024/09/09 15:15:24 riastradh Exp $	*/
+/*	$NetBSD: stdlib.h,v 1.127 2024/10/11 18:43:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -117,7 +117,6 @@ void	*malloc(size_t);
 void	 qsort(void *, size_t, size_t, int (*)(const void *, const void *));
 int	 rand(void);
 void	*realloc(void *, size_t);
-void	*reallocarray(void *, size_t, size_t);
 void	 srand(unsigned);
 double	 strtod(const char * __restrict, char ** __restrict);
 long	 strtol(const char * __restrict, char ** __restrict, int);
@@ -395,6 +394,11 @@ size_t	 wcstombs_l(char * __restrict, co
 #  endif /* _NETBSD_SOURCE */
 #endif /* _POSIX_C_SOURCE >= 200809 || _NETBSD_SOURCE */
 
+#if (_POSIX_C_SOURCE - 0) >= 202405L || \
+    defined(_NETBSD_SOURCE) || defined(_OPENBSD_SOURCE)
+void	*reallocarray(void *, size_t, size_t);
+#endif	/* _POSIX_C_SOURCE >= 202405L || _NETBSD_SOURCE || _OPENBSD_SOURCE */
+
 __END_DECLS
 
 #endif /* !_STDLIB_H_ */

Reply via email to