From f1f82c21054bfec3d5e1cf7918eb0b42e596cb20 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 2 Jul 2024 14:26:19 +0200 Subject: [PATCH] lib/port.c: getportent(): Remove obvious comments And do some style changes on the corresponding code. Signed-off-by: Alejandro Colomar --- lib/port.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/port.c b/lib/port.c index 7348030e5..f55bc724c 100644 --- a/lib/port.c +++ b/lib/port.c @@ -131,19 +131,14 @@ static struct port *getportent (void) */ next: - - /* - * Get the next line and remove optional trailing '\n'. - * Lines which begin with '#' are all ignored. - */ - - if (fgets (buf, sizeof buf, ports) == 0) { + if (fgets(buf, sizeof(buf), ports) == NULL) { errno = saveerr; - return 0; + return NULL; } - if ('#' == buf[0]) { + if ('#' == buf[0]) goto next; - } + + stpcpy(strchrnul(buf, '\n'), ""); /* * Get the name of the TTY device. It is the first colon @@ -152,8 +147,6 @@ next: * TTY devices. */ - stpcpy(strchrnul(buf, '\n'), ""); - port.pt_names = ttys; for (cp = buf, j = 0; j < PORT_TTY; j++) { port.pt_names[j] = cp; -- 2.47.3