[glib: 3/5] gspawn: Rewrite some retry loops to use `while` rather than `goto`
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 3/5] gspawn: Rewrite some retry loops to use `while` rather than `goto`
- Date: Thu, 26 Sep 2019 14:01:34 +0000 (UTC)
commit eae72c3597276bf7cda994d5262ec0421fd4c4f1
Author: Philip Withnall <withnall endlessm com>
Date: Thu Sep 26 14:10:36 2019 +0100
gspawn: Rewrite some retry loops to use `while` rather than `goto`
This introduces no functional changes, but does make the code easier to
understand.
Signed-off-by: Philip Withnall <withnall endlessm com>
glib/gspawn.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/glib/gspawn.c b/glib/gspawn.c
index f17559a48..2c154da5d 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -1131,10 +1131,9 @@ sane_close (gint fd)
{
gint ret;
- retry:
- ret = close (fd);
- if (ret < 0 && errno == EINTR)
- goto retry;
+ do
+ ret = close (fd);
+ while (ret < 0 && errno == EINTR);
return ret;
}
@@ -1296,10 +1295,9 @@ sane_dup2 (gint fd1, gint fd2)
{
gint ret;
- retry:
- ret = dup2 (fd1, fd2);
- if (ret < 0 && errno == EINTR)
- goto retry;
+ do
+ ret = dup2 (fd1, fd2);
+ while (ret < 0 && errno == EINTR);
return ret;
}
@@ -1309,10 +1307,9 @@ sane_open (const char *path, gint mode)
{
gint ret;
- retry:
- ret = open (path, mode);
- if (ret < 0 && errno == EINTR)
- goto retry;
+ do
+ ret = open (path, mode);
+ while (ret < 0 && errno == EINTR);
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]