Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110803181908.GZ132@brightrain.aerifal.cx>
Date: Wed, 3 Aug 2011 14:19:08 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: cluts weekly reports

On Wed, Aug 03, 2011 at 08:03:06PM +0200, Luka Marčetić wrote:
> Ideally what I'd want is:
> 
>     fp(args)
> 
> where fp is a function pointer to functions with different
> prototypes, and args are a number of arguments, each of an arbitrary
> type. Or at least:
> 
>     if (nr_args == 1)
>         fp (*(type[0] *) arg[0]);
>     else if (nr_args == 2)
>         fp (*(type[0] *) arg[0], *(type[1] *) arg[1]);
> 
> What I'm doing instead essentially is:
> 
>     if (fp == specific_function)
>         specific_function(*(int*)arg[0], *(char **)arg[1]);
>     else if (fp == another_function)
>         another_function(*(size_t *)arg[0]);

There's definitely a better way to do this. If nothing else, you could
write one-line wrappers for each function you want to test and put a
pointer to the wrapper rather than the function itself in the table.

> That just dislocates above, and puts it into the function to be
> called with the arg pointer (and, don't forget, the function
> identifier). I can go to IRC if you want to see what the generator
> output is/should be, and based on what input.

Could you include some here?

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.