policy is that all public functions which have a public declaration should be defined in a context where that public declaration is visible, to avoid preventable type mismatches. an audit performed using GCC's -Wmissing-declarations turned up the violations corrected here. in some cases the public header had not been included; in others, a feature test macro needed to make the declaration visible had been omitted. in the case of gethostent and getnetent, the omission seems to have been intentional, as a hack to admit a single stub definition for both functions. this kind of hack is no longer acceptable; it's UB and would not fly with LTO or advanced toolchains. the hack is undone to make exposure of the declarations possible.
26 lines
374 B
C
26 lines
374 B
C
#include "stdio_impl.h"
|
|
#include <stdio_ext.h>
|
|
|
|
size_t __freadahead(FILE *f)
|
|
{
|
|
return f->rend - f->rpos;
|
|
}
|
|
|
|
const char *__freadptr(FILE *f, size_t *sizep)
|
|
{
|
|
size_t size = f->rend - f->rpos;
|
|
if (!size) return 0;
|
|
*sizep = size;
|
|
return (const char *)f->rpos;
|
|
}
|
|
|
|
void __freadptrinc(FILE *f, size_t inc)
|
|
{
|
|
f->rpos += inc;
|
|
}
|
|
|
|
void __fseterr(FILE *f)
|
|
{
|
|
f->flags |= F_ERR;
|
|
}
|