In my opinion a far better way would be to add an additional void * argument
which is passed unchanged to the hook. Like:

struct local
{
   ...
};

main_func ()
{
struct local locvars;

grub_*_iterate (arg1,arg2,arg3, &locvars);
}

hook (arg1, arg2, arg3, voidparg)
{
struct local *locvars = (struct local *) voidparg;

}

On Sun, Apr 19, 2009 at 4:29 PM, Pavel Roskin <pro...@gnu.org> wrote:

> Quoting Bean <bean12...@gmail.com>:
>
>  Yeah, I agree with you. The conversion will take some effort, but it
>> could payoff in the long run. Perhaps we can achieve this in two
>> steps:
>>
>> 1, Change nested function definition to accept only one parameter. For
>> function with multiple parameters, place them in a structure and pass
>> the pointer. This would eliminate NESTED_FUNC_ATTR, as the regparm
>> issue won't occur in function with only one parameter.
>>
>> 2. Eliminate nested function. This would be easier after step 1. As we
>> now pass parameters in a structure, we can append extra variables at
>> the end, and cast it to the required type. Inside the callback
>> function, we cast it back to use the extra fields.
>>
>
> That's an excellent plan!  Thank you!
>
> Considering the amount of changes, it may be a good idea to use the git
> mirror with stgit, so that several patches can be made and everything is
> well tested together before applying.
>
> --
> Regards,
> Pavel Roskin
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to