mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-25 12:11:10 +00:00
nss_files: Use generic result pointer in parse_line
As a result, all parse_line functions have the same prototype, except for that producing struct hostent. This change is ABI-compatible, so it does not alter the internal GLIBC_PRIVATE ABI (otherwise we should probably have renamed the exported functions). A future change will use this to implement a generict fget*ent_r function. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
parent
e9b2340998
commit
9980bf0b30
@ -26,45 +26,21 @@ FILE *__nss_files_fopen (const char *path);
|
||||
libc_hidden_proto (__nss_files_fopen)
|
||||
|
||||
struct parser_data;
|
||||
struct etherent;
|
||||
struct group;
|
||||
struct netent;
|
||||
struct passwd;
|
||||
struct protoent;
|
||||
struct rpcent;
|
||||
struct servent;
|
||||
struct sgrp;
|
||||
struct spwd;
|
||||
|
||||
/* Instances of the parse_line function from
|
||||
nss/nss_files/files-parse.c. */
|
||||
extern int _nss_files_parse_etherent (char *line, struct etherent *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_grent (char *line, struct group *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_netent (char *line, struct netent *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_protoent (char *line, struct protoent *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_pwent (char *line, struct passwd *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_rpcent (char *line, struct rpcent *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_servent (char *line, struct servent *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_sgent (char *line, struct sgrp *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern int _nss_files_parse_spent (char *line, struct spwd *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
typedef int nss_files_parse_line (char *line, void *result,
|
||||
struct parser_data *data,
|
||||
size_t datalen, int *errnop);
|
||||
extern nss_files_parse_line _nss_files_parse_etherent;
|
||||
extern nss_files_parse_line _nss_files_parse_grent;
|
||||
extern nss_files_parse_line _nss_files_parse_netent;
|
||||
extern nss_files_parse_line _nss_files_parse_protoent;
|
||||
extern nss_files_parse_line _nss_files_parse_pwent;
|
||||
extern nss_files_parse_line _nss_files_parse_rpcent;
|
||||
extern nss_files_parse_line _nss_files_parse_servent;
|
||||
extern nss_files_parse_line _nss_files_parse_sgent;
|
||||
extern nss_files_parse_line _nss_files_parse_spent;
|
||||
|
||||
libnss_files_hidden_proto (_nss_files_parse_etherent)
|
||||
libc_hidden_proto (_nss_files_parse_grent)
|
||||
|
@ -87,7 +87,7 @@ struct parser_data
|
||||
#ifdef EXTERN_PARSER
|
||||
|
||||
/* The parser is defined in a different module. */
|
||||
extern int parse_line (char *line, struct STRUCTURE *result,
|
||||
extern int parse_line (char *line, void *result,
|
||||
struct parser_data *data, size_t datalen, int *errnop
|
||||
EXTRA_ARGS_DECL);
|
||||
|
||||
@ -99,10 +99,11 @@ extern int parse_line (char *line, struct STRUCTURE *result,
|
||||
|
||||
# define LINE_PARSER(EOLSET, BODY) \
|
||||
parser_stclass int \
|
||||
parse_line (char *line, struct STRUCTURE *result, \
|
||||
parse_line (char *line, void *generic_result, \
|
||||
struct parser_data *data, size_t datalen, int *errnop \
|
||||
EXTRA_ARGS_DECL) \
|
||||
{ \
|
||||
struct STRUCTURE *result = generic_result; \
|
||||
ENTDATA_DECL (data) \
|
||||
BUFFER_PREPARE \
|
||||
char *p = strpbrk (line, EOLSET "\n"); \
|
||||
|
Loading…
Reference in New Issue
Block a user