Remove _WITH_GETLINE and _WITH_DPRINTF guards
When adding getline(3) and dprintf(3) into libc, those guards were added to prevent breaking too many ports. 7 years later the ports tree have been fixed, it is time to remove this FreeBSDism While here remove the extra parenthesis surrounding dprintf(3)
This commit is contained in:
parent
9b4009b417
commit
dd47921eac
@ -357,44 +357,8 @@ ssize_t getdelim(char ** __restrict, size_t * __restrict, int,
|
||||
FILE *open_memstream(char **, size_t *);
|
||||
int renameat(int, const char *, int, const char *);
|
||||
int vdprintf(int, const char * __restrict, __va_list);
|
||||
|
||||
/*
|
||||
* Every programmer and his dog wrote functions called getline() and dprintf()
|
||||
* before POSIX.1-2008 came along and decided to usurp the names, so we
|
||||
* don't prototype them by default unless one of the following is true:
|
||||
* a) the app has requested them specifically by defining _WITH_GETLINE or
|
||||
* _WITH_DPRINTF, respectively
|
||||
* b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE
|
||||
* c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE
|
||||
*/
|
||||
#ifndef _WITH_GETLINE
|
||||
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define _WITH_GETLINE
|
||||
#elif defined(_POSIX_C_SOURCE)
|
||||
#if _POSIX_C_SOURCE >= 200809
|
||||
#define _WITH_GETLINE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WITH_GETLINE
|
||||
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
|
||||
#endif
|
||||
|
||||
#ifndef _WITH_DPRINTF
|
||||
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define _WITH_DPRINTF
|
||||
#elif defined(_POSIX_C_SOURCE)
|
||||
#if _POSIX_C_SOURCE >= 200809
|
||||
#define _WITH_DPRINTF
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WITH_DPRINTF
|
||||
int (dprintf)(int, const char * __restrict, ...);
|
||||
#endif
|
||||
|
||||
int dprintf(int, const char * __restrict, ...);
|
||||
#endif /* __POSIX_VISIBLE >= 200809 */
|
||||
|
||||
/*
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 30, 2012
|
||||
.Dd July 30, 2016
|
||||
.Dt GETLINE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -34,7 +34,6 @@
|
||||
.Sh LIBRARY
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.Fd "#define _WITH_GETLINE"
|
||||
.In stdio.h
|
||||
.Ft ssize_t
|
||||
.Fn getdelim "char ** restrict linep" "size_t * restrict linecapp" "int delimiter" " FILE * restrict stream"
|
||||
@ -97,34 +96,6 @@ while ((linelen = getline(&line, &linecap, fp)) > 0)
|
||||
fwrite(line, linelen, 1, stdout);
|
||||
free(line);
|
||||
.Ed
|
||||
.Sh COMPATIBILITY
|
||||
Many application writers used the name
|
||||
.Va getline
|
||||
before the
|
||||
.Fn getline
|
||||
function was introduced in
|
||||
.St -p1003.1 ,
|
||||
so a prototype is not provided by default in order to avoid
|
||||
compatibility problems.
|
||||
Applications that wish to use the
|
||||
.Fn getline
|
||||
function described herein should either request a strict
|
||||
.St -p1003.1-2008
|
||||
environment by defining the macro
|
||||
.Dv _POSIX_C_SOURCE
|
||||
to the value 200809 or greater, or by defining the macro
|
||||
.Dv _WITH_GETLINE ,
|
||||
prior to the inclusion of
|
||||
.In stdio.h .
|
||||
For compatibility with GNU libc, defining either
|
||||
.Dv _BSD_SOURCE
|
||||
or
|
||||
.Dv _GNU_SOURCE
|
||||
prior to the inclusion of
|
||||
.In stdio.h
|
||||
will also make
|
||||
.Fn getline
|
||||
available.
|
||||
.Sh ERRORS
|
||||
These functions may fail if:
|
||||
.Bl -tag -width Er
|
||||
|
@ -32,7 +32,7 @@
|
||||
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 2, 2009
|
||||
.Dd July 30, 2016
|
||||
.Dt PRINTF 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -42,7 +42,6 @@
|
||||
.Sh LIBRARY
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.Fd "#define _WITH_DPRINTF"
|
||||
.In stdio.h
|
||||
.Ft int
|
||||
.Fn printf "const char * restrict format" ...
|
||||
@ -715,34 +714,6 @@ char *newfmt(const char *fmt, ...)
|
||||
}
|
||||
.Ed
|
||||
.Sh COMPATIBILITY
|
||||
Many application writers used the name
|
||||
.Va dprintf
|
||||
before the
|
||||
.Fn dprintf
|
||||
function was introduced in
|
||||
.St -p1003.1 ,
|
||||
so a prototype is not provided by default in order to avoid
|
||||
compatibility problems.
|
||||
Applications that wish to use the
|
||||
.Fn dprintf
|
||||
function described herein should either request a strict
|
||||
.St -p1003.1-2008
|
||||
environment by defining the macro
|
||||
.Dv _POSIX_C_SOURCE
|
||||
to the value 200809 or greater, or by defining the macro
|
||||
.Dv _WITH_DPRINTF ,
|
||||
prior to the inclusion of
|
||||
.In stdio.h .
|
||||
For compatibility with GNU libc, defining either
|
||||
.Dv _BSD_SOURCE
|
||||
or
|
||||
.Dv _GNU_SOURCE
|
||||
prior to the inclusion of
|
||||
.In stdio.h
|
||||
will also make
|
||||
.Fn dprintf
|
||||
available.
|
||||
.Pp
|
||||
The conversion formats
|
||||
.Cm \&%D , \&%O ,
|
||||
and
|
||||
|
Loading…
x
Reference in New Issue
Block a user