[PATCH] nss_files: use booleans in parser macro calls
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Tue May 19 13:15:47 GMT 2026
On 19/05/26 08:37, Andreas Schwab wrote:
> The swallow argument in the INT_FIELD and STRING_FIELD macros is used as a
> boolean, change all callers to use false and true instead of 0 and 1.
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> nss/nss_files/files-ethers.c | 6 +++---
> nss/nss_files/files-hosts.c | 4 ++--
> nss/nss_files/files-network.c | 4 ++--
> nss/nss_files/files-parse.c | 1 +
> nss/nss_files/files-proto.c | 4 ++--
> nss/nss_files/files-rpc.c | 4 ++--
> nss/nss_files/files-service.c | 6 +++---
> 7 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/nss/nss_files/files-ethers.c b/nss/nss_files/files-ethers.c
> index a689b1a5b4..bdbb64d699 100644
> --- a/nss/nss_files/files-ethers.c
> +++ b/nss/nss_files/files-ethers.c
> @@ -36,16 +36,16 @@ LINE_PARSER
> unsigned int number;
>
> if (cnt < 5)
> - INT_FIELD (number, ISCOLON , 0, 16, (unsigned int))
> + INT_FIELD (number, ISCOLON , false, 16, (unsigned int))
> else
> - INT_FIELD (number, isspace, 1, 16, (unsigned int))
> + INT_FIELD (number, isspace, true, 16, (unsigned int))
>
> if (number > 0xff)
> return 0;
> result->e_addr.ether_addr_octet[cnt] = number;
> }
> };
> - STRING_FIELD (result->e_name, isspace, 1);
> + STRING_FIELD (result->e_name, isspace, true);
> )
>
>
> diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
> index bfbffa3b54..8d7c90945a 100644
> --- a/nss/nss_files/files-hosts.c
> +++ b/nss/nss_files/files-hosts.c
> @@ -53,7 +53,7 @@ LINE_PARSER
> {
> char *addr;
>
> - STRING_FIELD (addr, isspace, 1);
> + STRING_FIELD (addr, isspace, true);
>
> /* Parse address. */
> if (__inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr)
> @@ -96,7 +96,7 @@ LINE_PARSER
> entdata->h_addr_ptrs[1] = NULL;
> result->h_addr_list = entdata->h_addr_ptrs;
>
> - STRING_FIELD (result->h_name, isspace, 1);
> + STRING_FIELD (result->h_name, isspace, true);
> })
>
> #define EXTRA_ARGS_VALUE , AF_INET, 0
> diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c
> index 86cab9e4e9..b5d6f536f9 100644
> --- a/nss/nss_files/files-network.c
> +++ b/nss/nss_files/files-network.c
> @@ -38,9 +38,9 @@ LINE_PARSER
> char *cp;
> int n = 1;
>
> - STRING_FIELD (result->n_name, isspace, 1);
> + STRING_FIELD (result->n_name, isspace, true);
>
> - STRING_FIELD (addr, isspace, 1);
> + STRING_FIELD (addr, isspace, true);
> /* 'inet_network' does not add zeroes at the end if the network number
> does not contain four byte values. We shift result ourselves if
> necessary. */
> diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c
> index 016b0965e4..f9fcb64c01 100644
> --- a/nss/nss_files/files-parse.c
> +++ b/nss/nss_files/files-parse.c
> @@ -20,6 +20,7 @@
> #include <errno.h>
> #include <string.h>
> #include <stdlib.h>
> +#include <stdbool.h>
> #include <stdint.h>
> #include <nss_files.h>
>
> diff --git a/nss/nss_files/files-proto.c b/nss/nss_files/files-proto.c
> index 59dc134fe6..398ba85519 100644
> --- a/nss/nss_files/files-proto.c
> +++ b/nss/nss_files/files-proto.c
> @@ -29,8 +29,8 @@ struct protoent_data {};
> #include "files-parse.c"
> LINE_PARSER
> ("#",
> - STRING_FIELD (result->p_name, isspace, 1);
> - INT_FIELD (result->p_proto, isspace, 1, 10,);
> + STRING_FIELD (result->p_name, isspace, true);
> + INT_FIELD (result->p_proto, isspace, true, 10,);
> )
>
> #include GENERIC
> diff --git a/nss/nss_files/files-rpc.c b/nss/nss_files/files-rpc.c
> index 76056c04e8..f159f04686 100644
> --- a/nss/nss_files/files-rpc.c
> +++ b/nss/nss_files/files-rpc.c
> @@ -29,8 +29,8 @@ struct rpcent_data {};
> #include "files-parse.c"
> LINE_PARSER
> ("#",
> - STRING_FIELD (result->r_name, isspace, 1);
> - INT_FIELD (result->r_number, isspace, 1, 10,);
> + STRING_FIELD (result->r_name, isspace, true);
> + INT_FIELD (result->r_number, isspace, true, 10,);
> )
>
> #include GENERIC
> diff --git a/nss/nss_files/files-service.c b/nss/nss_files/files-service.c
> index 2ba48b798d..ba141438c4 100644
> --- a/nss/nss_files/files-service.c
> +++ b/nss/nss_files/files-service.c
> @@ -31,9 +31,9 @@ struct servent_data {};
> #define ISSLASH(c) ((c) == '/')
> LINE_PARSER
> ("#",
> - STRING_FIELD (result->s_name, isspace, 1);
> - INT_FIELD (result->s_port, ISSLASH, 0, 10, htons);
> - STRING_FIELD (result->s_proto, isspace, 1);
> + STRING_FIELD (result->s_name, isspace, true);
> + INT_FIELD (result->s_port, ISSLASH, false, 10, htons);
> + STRING_FIELD (result->s_proto, isspace, true);
> )
>
> #include GENERIC
More information about the Libc-alpha
mailing list