Am Freitag, den 12.02.2010, 03:59 +0100 schrieb Carl-Daniel Hailfinger: 
> +#define SHUTDOWN_MAXFN 4
> +static int shutdown_fn_count = 0;
> +void (*shutdown_fn[SHUTDOWN_MAXFN]) (void);
style hint: Use a typedef for the function pointer type:
typedef void (*shutdown_proc)(void);
shutdown_proc shutdownfn[SHUTDOWN_MAXFN];

> +int register_shutdown(void (*function)(void))
And this gets "int register_shutdown(shutdown_proc function)

> +{
> +     if (shutdown_fn_count >= SHUTDOWN_MAXFN) {
> +             msg_perr("Tried to register more than %n shutdown functions.\n",
> +                      SHUTDOWN_MAXFN);
> +             return 1;
> +     }
> +     shutdown_fn[shutdown_fn_count++] = function;
> +
> +     return 0;
> +}
> +
>  int programmer_shutdown(void)
>  {
> +     int i;
> +
> +     for (i = shutdown_fn_count - 1; i >= 0; i--)
> +             shutdown_fn[i]();
>       return programmer_table[programmer].shutdown();
>  }

Except for the style hint, everything looks great, so
Acked-by: Michael Karcher <[email protected]>



_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to