public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1598] libiberty: writeargv: Simplify function error mode.
@ 2023-06-07 2:51 Jeff Law
0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2023-06-07 2:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3fe017ee79211820ca774f4c87ef86753eeef567
commit r14-1598-g3fe017ee79211820ca774f4c87ef86753eeef567
Author: Costas Argyris <costas.argyris@gmail.com>
Date: Tue Jun 6 20:50:07 2023 -0600
libiberty: writeargv: Simplify function error mode.
You are right, this is also a remnant of the old function design
that I completely missed. Here is the follow-up patch for that.
Thanks for pointing it out.
Costas
On Tue, 6 Jun 2023 at 04:12, Jeff Law <jeffreyalaw@gmail.com> wrote:
On 6/5/23 08:37, Costas Argyris via Gcc-patches wrote:
> writeargv can be simplified by getting rid of the error exit mode
> that was only relevant many years ago when the function used
> to open the file descriptor internally.
[ ... ]
Thanks. I've pushed this to the trunk.
You could (as a follow-up) simplify it even further. There's no need
for the status variable as far as I can tell. You could just have the
final return be "return 0;" instead of "return status;".
libiberty/
* argv.c (writeargv): Constant propagate "0" for "status",
simplifying the code slightly.
Diff:
---
libiberty/argv.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libiberty/argv.c b/libiberty/argv.c
index 1a18b4d8866..c2823d3e4ba 100644
--- a/libiberty/argv.c
+++ b/libiberty/argv.c
@@ -299,8 +299,6 @@ non-zero if an error occurred while writing to FILE.
int
writeargv (char * const *argv, FILE *f)
{
- int status = 0;
-
if (f == NULL)
return 1;
@@ -333,7 +331,7 @@ writeargv (char * const *argv, FILE *f)
argv++;
}
- return status;
+ return 0;
}
/*
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-07 2:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 2:51 [gcc r14-1598] libiberty: writeargv: Simplify function error mode Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).