[Openais] [PATCH corosync] totemsrp: remove unnecessary cast to avoid "make syntax-check" failure

Steven Dake sdake at redhat.com
Sun Jun 21 10:33:15 PDT 2009


On Sun, 2009-06-21 at 18:59 +0200, Jim Meyering wrote:
> Hi,
> 
> alloca is always declared to return "void *", these days.
> Without it', and with my pending gnulib patch, "make syntax-check"
> would fail, complaining about the unneeded cast.
> 
> While on the subject, it's best to avoid alloca altogether,
> unless you can guarantee that the required buffer length is
> always < 1kB or 4kB, depending on how much you care about
> embedded systems and/or stack-limited systems.
> However, using malloc might be more invasive, due to the
> need to handle failure.
> 
> From d07797efa5e2e67a78df8df26764220f31d9a8a8 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Sun, 21 Jun 2009 18:55:14 +0200
> Subject: [PATCH corosync] totemsrp: remove unnecessary cast to avoid "make syntax-check" failure
> 
> * exec/totemsrp.c (message_handler_memb_join): Remove unnecessary
> cast of alloca return value.
> ---
>  exec/totemsrp.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/exec/totemsrp.c b/exec/totemsrp.c
> index f0501a9..94bb37b 100644
> --- a/exec/totemsrp.c
> +++ b/exec/totemsrp.c
> @@ -4023,7 +4023,7 @@ static int message_handler_memb_join (
>  	int endian_conversion_needed)
>  {
>  	const struct memb_join *memb_join;
> -	struct memb_join *memb_join_convert = (struct memb_join *)alloca (msg_len);
> +	struct memb_join *memb_join_convert = alloca (msg_len);
>  	int gather_entered;
> 
>  	if (endian_conversion_needed) {
> --
> 1.6.3.2.448.g363bdb

This returns a warning on solaris which is why I made the change to cast
it.

I am aware of the limitations of alloca but we have no way to handle
failure in this part of the code.

> _______________________________________________
> Openais mailing list
> Openais at lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/openais



More information about the Openais mailing list