* [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo.
@ 2012-06-25 11:22 Henrik Hautakoski
2012-06-25 11:22 ` [lttng-dev] [PATCH 2/2] liblttng-ust-comm/lttng-ust-com.c: remove unnecessary goto in ustcomm_accept_unix_sock() Henrik Hautakoski
2012-06-26 5:52 ` [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo Mathieu Desnoyers
0 siblings, 2 replies; 4+ messages in thread
From: Henrik Hautakoski @ 2012-06-25 11:22 UTC (permalink / raw)
Signed-off-by: Henrik Hautakoski <henrik at fiktivkod.org>
---
liblttng-ust/lttng-ust-comm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
index 4104a3f..deca7cb 100644
--- a/liblttng-ust/lttng-ust-comm.c
+++ b/liblttng-ust/lttng-ust-comm.c
@@ -681,7 +681,7 @@ error:
* This thread does not allocate any resource, except within
* handle_message, within mutex protection. This mutex protects against
* fork and exit.
- * The other moment it allocates resources is at socket connexion, which
+ * The other moment it allocates resources is at socket connection, which
* is also protected by the mutex.
*/
static
--
1.7.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* [lttng-dev] [PATCH 2/2] liblttng-ust-comm/lttng-ust-com.c: remove unnecessary goto in ustcomm_accept_unix_sock()
2012-06-25 11:22 [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo Henrik Hautakoski
@ 2012-06-25 11:22 ` Henrik Hautakoski
2012-06-26 6:00 ` Mathieu Desnoyers
2012-06-26 5:52 ` [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo Mathieu Desnoyers
1 sibling, 1 reply; 4+ messages in thread
From: Henrik Hautakoski @ 2012-06-25 11:22 UTC (permalink / raw)
Signed-off-by: Henrik Hautakoski <henrik at fiktivkod.org>
---
liblttng-ust-comm/lttng-ust-comm.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c
index 078b56a..1e2fd1a 100644
--- a/liblttng-ust-comm/lttng-ust-comm.c
+++ b/liblttng-ust-comm/lttng-ust-comm.c
@@ -172,13 +172,9 @@ int ustcomm_accept_unix_sock(int sock)
new_fd = accept(sock, (struct sockaddr *) &sun, &len);
if (new_fd < 0) {
perror("accept");
- goto error;
+ return -1;
}
-
return new_fd;
-
-error:
- return -1;
}
/*
--
1.7.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread* [lttng-dev] [PATCH 2/2] liblttng-ust-comm/lttng-ust-com.c: remove unnecessary goto in ustcomm_accept_unix_sock()
2012-06-25 11:22 ` [lttng-dev] [PATCH 2/2] liblttng-ust-comm/lttng-ust-com.c: remove unnecessary goto in ustcomm_accept_unix_sock() Henrik Hautakoski
@ 2012-06-26 6:00 ` Mathieu Desnoyers
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2012-06-26 6:00 UTC (permalink / raw)
* Henrik Hautakoski (henrik at fiktivkod.org) wrote:
> Signed-off-by: Henrik Hautakoski <henrik at fiktivkod.org>
In this specific case, this is right that the goto appears to be really
useless. Although I would not merge this kind of change in all cases: if
in another situation the function appears to be bound to have other
calls in the future, using gotos allow to do the teardown of the
function in error cases in a symmetric way:
a = fct();
if (!a)
goto error_a;
b = fct2();
if (!b)
goto error_b;
return 0; /* OK */
error_b:
teardown(a);
error_a:
return -1;
So the intend in ustcomm_accept_unix_sock() was to ensure that as the
function grows to contain more calls, the teardown can be done
symmetrically in this way. But I guess it appears that it won't grow, so
I'm taking the cleanup.
Thanks,
Mathieu
> ---
> liblttng-ust-comm/lttng-ust-comm.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c
> index 078b56a..1e2fd1a 100644
> --- a/liblttng-ust-comm/lttng-ust-comm.c
> +++ b/liblttng-ust-comm/lttng-ust-comm.c
> @@ -172,13 +172,9 @@ int ustcomm_accept_unix_sock(int sock)
> new_fd = accept(sock, (struct sockaddr *) &sun, &len);
> if (new_fd < 0) {
> perror("accept");
> - goto error;
> + return -1;
> }
> -
> return new_fd;
> -
> -error:
> - return -1;
> }
>
> /*
> --
> 1.7.9.5
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo.
2012-06-25 11:22 [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo Henrik Hautakoski
2012-06-25 11:22 ` [lttng-dev] [PATCH 2/2] liblttng-ust-comm/lttng-ust-com.c: remove unnecessary goto in ustcomm_accept_unix_sock() Henrik Hautakoski
@ 2012-06-26 5:52 ` Mathieu Desnoyers
1 sibling, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2012-06-26 5:52 UTC (permalink / raw)
* Henrik Hautakoski (henrik at fiktivkod.org) wrote:
> Signed-off-by: Henrik Hautakoski <henrik at fiktivkod.org>
merged, thanks!
Mathieu
> ---
> liblttng-ust/lttng-ust-comm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
> index 4104a3f..deca7cb 100644
> --- a/liblttng-ust/lttng-ust-comm.c
> +++ b/liblttng-ust/lttng-ust-comm.c
> @@ -681,7 +681,7 @@ error:
> * This thread does not allocate any resource, except within
> * handle_message, within mutex protection. This mutex protects against
> * fork and exit.
> - * The other moment it allocates resources is at socket connexion, which
> + * The other moment it allocates resources is at socket connection, which
> * is also protected by the mutex.
> */
> static
> --
> 1.7.9.5
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-26 6:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-25 11:22 [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo Henrik Hautakoski
2012-06-25 11:22 ` [lttng-dev] [PATCH 2/2] liblttng-ust-comm/lttng-ust-com.c: remove unnecessary goto in ustcomm_accept_unix_sock() Henrik Hautakoski
2012-06-26 6:00 ` Mathieu Desnoyers
2012-06-26 5:52 ` [lttng-dev] [PATCH 1/2] liblttng-ust/lttng-ust-comm.c: fixing typo Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox