Macro g_assert_no_errno() intrudes into GLib's namespace. It's also
pretty pointless. Inline.
At one call site, its redundancy is now obvious. Delete it there.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
tests/libqtest.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 2cd5736642..44ce118cfc 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -48,10 +48,6 @@ struct QTestState
static GHookList abrt_hooks;
static struct sigaction sigact_old;
-#define g_assert_no_errno(ret) do { \
- g_assert_cmpint(ret, !=, -1); \
-} while (0)
-
static int qtest_query_target_endianness(QTestState *s);
static int init_socket(const char *socket_path)
@@ -61,7 +57,7 @@ static int init_socket(const char *socket_path)
int ret;
sock = socket(PF_UNIX, SOCK_STREAM, 0);
- g_assert_no_errno(sock);
+ g_assert_cmpint(sock, !=, -1);
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path);
@@ -70,9 +66,9 @@ static int init_socket(const char *socket_path)
do {
ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr));
} while (ret == -1 && errno == EINTR);
- g_assert_no_errno(ret);
+ g_assert_cmpint(ret, !=, -1);
ret = listen(sock, 1);
- g_assert_no_errno(ret);
+ g_assert_cmpint(ret, !=, -1);
return sock;
}
@@ -325,7 +321,6 @@ static void socket_send(int fd, const char *buf, size_t size)
continue;
}
- g_assert_no_errno(len);
g_assert_cmpint(len, >, 0);
offset += len;
--
2.17.1
On 26/09/2018 14:29, Markus Armbruster wrote: > Macro g_assert_no_errno() intrudes into GLib's namespace. It's also > pretty pointless. Inline. > > At one call site, its redundancy is now obvious. Delete it there. > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > tests/libqtest.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > Reviewed-by: Laurent Vivier <lvivier@redhat.com>
On 2018-09-26 14:29, Markus Armbruster wrote: > Macro g_assert_no_errno() intrudes into GLib's namespace. It's also > pretty pointless. Inline. > > At one call site, its redundancy is now obvious. Delete it there. > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > tests/libqtest.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/tests/libqtest.c b/tests/libqtest.c > index 2cd5736642..44ce118cfc 100644 > --- a/tests/libqtest.c > +++ b/tests/libqtest.c > @@ -48,10 +48,6 @@ struct QTestState > static GHookList abrt_hooks; > static struct sigaction sigact_old; > > -#define g_assert_no_errno(ret) do { \ > - g_assert_cmpint(ret, !=, -1); \ > -} while (0) > - > static int qtest_query_target_endianness(QTestState *s); > > static int init_socket(const char *socket_path) > @@ -61,7 +57,7 @@ static int init_socket(const char *socket_path) > int ret; > > sock = socket(PF_UNIX, SOCK_STREAM, 0); > - g_assert_no_errno(sock); > + g_assert_cmpint(sock, !=, -1); > > addr.sun_family = AF_UNIX; > snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path); > @@ -70,9 +66,9 @@ static int init_socket(const char *socket_path) > do { > ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr)); > } while (ret == -1 && errno == EINTR); > - g_assert_no_errno(ret); > + g_assert_cmpint(ret, !=, -1); > ret = listen(sock, 1); > - g_assert_no_errno(ret); > + g_assert_cmpint(ret, !=, -1); > > return sock; > } > @@ -325,7 +321,6 @@ static void socket_send(int fd, const char *buf, size_t size) > continue; > } > > - g_assert_no_errno(len); > g_assert_cmpint(len, >, 0); > > offset += len; Reviewed-by: Thomas Huth <thuth@redhat.com>
© 2016 - 2024 Red Hat, Inc.