This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] bug fix for gengtype in plugin mode
Diego Novillo wrote:
> On Wed, Sep 23, 2009 at 18:12, Rafael Espindola <espindola@google.com> wrote:
>
>> @@ -3657,8 +3658,17 @@ main (int argc, char **argv)
>> {
>> srcdir = argv[2];
>> inputlist = argv[3];
>> - plugin_files = argv+4;
>> nb_plugin_files = argc-4;
>> + plugin_files = XNEWVEC (char *, nb_plugin_files);
>
> s/XNEWVEC/XCNEWVEC/
>
>> + for (i = 0; i < nb_plugin_files; i++)
>> + {
>> + /* Place an all zero lang_bitmap before the plugin file
>> + name. */
>> + char *name = argv[i + 4];
>> + int len = strlen(name) + 1 + sizeof (lang_bitmap);
>> + plugin_files[i] = ((char *)xcalloc (len, sizeof(char))) + sizeof (lang_bitmap);
>
> space after '(char *)'. Line is too long.
sizeof(char) is never anything other than 1, btw., you could save a few
chars there. I'd write
+ plugin_files[i] = (char *) (1 + (lang_bitmap) xcalloc (len, 1));
cheers,
DaveK