This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH]: Revised stack alignment change, part 2/3


Daniel Berlin wrote:

>
> + static char *
> + build_aligned_name (name)
> +        const char *name;
> + {
> + /* FIXME: use ggc_alloc_string properly */
> +   char *aligned_name = xmalloc(strlen(name) + 9);
> +
> +   strcpy (aligned_name, name);
> +   strcat (aligned_name, ".aligned");
> +   return aligned_name;
> + }
> +

Why don't you fix the FIXME something alomg the
lines of the following should work.

static cont char *
build_aligned_name (name)
        const char *name;
{
   size_t len = strlen (name) + 9
   char *aligned_name = (char *)alloca (len);

   strcpy (aligned_name, name);
   strcat (aligned_name, ".aligned");
   return ggc_alloc_string (aligned_name, len);
}

Graham

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]