b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | --- a/lib/fcntl.c |
| 2 | +++ b/lib/fcntl.c |
| 3 | @@ -198,6 +198,8 @@ static int klibc_fcntl (int fd, int acti |
| 4 | FD_CLOEXEC is portable, but other flags may be present); otherwise |
| 5 | return -1 and set errno. */ |
| 6 | |
| 7 | +#if (GNULIB_defined_fcntl || GNULIB_defined_rpl_fcntl) |
| 8 | + |
| 9 | int |
| 10 | fcntl (int fd, int action, /* arg */...) |
| 11 | #undef fcntl |
| 12 | @@ -443,6 +445,8 @@ fcntl (int fd, int action, /* arg */...) |
| 13 | return result; |
| 14 | } |
| 15 | |
| 16 | +#endif /* (GNULIB_defined_fcntl || GNULIB_defined_rpl_fcntl) */ |
| 17 | + |
| 18 | static int |
| 19 | rpl_fcntl_DUPFD (int fd, int target) |
| 20 | { |
| 21 | --- a/lib/stdlib.in.h |
| 22 | +++ b/lib/stdlib.in.h |
| 23 | @@ -1447,10 +1447,16 @@ _GL_FUNCDECL_RPL (reallocarray, void *, |
| 24 | (void *ptr, size_t nmemb, size_t size)); |
| 25 | _GL_CXXALIAS_RPL (reallocarray, void *, |
| 26 | (void *ptr, size_t nmemb, size_t size)); |
| 27 | +# if !GNULIB_defined_rpl_reallocarray |
| 28 | +# define GNULIB_defined_rpl_reallocarray 1 |
| 29 | +# endif |
| 30 | # else |
| 31 | # if ! @HAVE_REALLOCARRAY@ |
| 32 | _GL_FUNCDECL_SYS (reallocarray, void *, |
| 33 | (void *ptr, size_t nmemb, size_t size)); |
| 34 | +# if !GNULIB_defined_reallocarray |
| 35 | +# define GNULIB_defined_reallocarray 1 |
| 36 | +# endif |
| 37 | # endif |
| 38 | _GL_CXXALIAS_SYS (reallocarray, void *, |
| 39 | (void *ptr, size_t nmemb, size_t size)); |
| 40 | --- a/lib/reallocarray.c |
| 41 | +++ b/lib/reallocarray.c |
| 42 | @@ -23,6 +23,8 @@ |
| 43 | #include <stdlib.h> |
| 44 | #include <errno.h> |
| 45 | |
| 46 | +#if (GNULIB_defined_reallocarray || GNULIB_defined_rpl_reallocarray) |
| 47 | + |
| 48 | void * |
| 49 | reallocarray (void *ptr, size_t nmemb, size_t size) |
| 50 | { |
| 51 | @@ -36,3 +38,5 @@ reallocarray (void *ptr, size_t nmemb, s |
| 52 | /* Rely on the semantics of GNU realloc. */ |
| 53 | return realloc (ptr, nbytes); |
| 54 | } |
| 55 | + |
| 56 | +#endif /* (GNULIB_defined_reallocarray || GNULIB_defined_rpl_reallocarray) */ |