From: Alejandro Colomar Date: Wed, 11 Dec 2024 22:03:54 +0000 (+0100) Subject: lib/fields.c: valid_field(): Clarify comments X-Git-Tag: 4.18.0-rc1~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5fc731dea62b542c68516872efa0fff818f5a1c;p=thirdparty%2Fshadow.git lib/fields.c: valid_field(): Clarify comments And apply minor style changes. Signed-off-by: Alejandro Colomar --- diff --git a/lib/fields.c b/lib/fields.c index 67c90b91c..b32ca4662 100644 --- a/lib/fields.c +++ b/lib/fields.c @@ -27,19 +27,16 @@ /* * valid_field - insure that a field contains all legal characters * - * The supplied field is scanned for non-printable and other illegal - * characters. - * + -1 is returned if an illegal or control character is present. - * + 1 is returned if no illegal or control characters are present, - * but the field contains a non-printable character. - * + 0 is returned otherwise. + * Return: + * -1 Illegal or control characters are present. + * 1 Non-ASCII characters are present. + * 0 All chatacters are legal and ASCII. */ int valid_field_(const char *field, const char *illegal) { - if (NULL == field) { + if (NULL == field) return -1; - } if (strpbrk(field, illegal)) return -1; @@ -50,7 +47,7 @@ valid_field_(const char *field, const char *illegal) if (streq(field, "")) return 0; - return 1; + return 1; // !ASCII } /*