[pacman-dev] callback functions

Aaron Griffin aaronmgriffin at gmail.com
Wed May 14 23:24:15 EDT 2008

On Wed, May 14, 2008 at 7:46 PM, Dan McGee <dpmcgee at gmail.com> wrote:
> On Wed, May 14, 2008 at 4:46 AM, Xavier <shiningxc at gmail.com> wrote:
>  > 2008/5/14 Nagy Gabor <ngaba at bibl.u-szeged.hu>:
> > About the dltotal thing, Dan indeed reverted it, but we need to add
>  > that feature back with another way.
>  > We currently have this callback :
>  > void cb_dl_progress(const char *filename, int xfered, int total)
>  > Dan suggested to add another one 2 days ago, I believe it was something like :
>  > void cb_dl_total_progress(int xfered, int total)
>  > But I already forgot. Dan, can you confirm this? :)
>  Yes, this is what I was thinking. The frontend(s) could then use these
>  two functions accordingly. Both would be called numerous times during
>  the download as they are now.
>  >>  In my opinion the parameters of callback functions should be reworked (warning,
>  >>  API change ;-). My preferred solution would be putting one param, a pointer to a
>  >>  complicated union or whatever, which can be accessed via
>  >>  alpm_info_get_xfered(ptr) etc. thus making it much more flexible. Thoughts?
>  I don't think this complexity is quite needed for the download
>  functions. Maybe the other functions later on though. Download we are
>  dealing with 4 numbers and a filename.

Using a struct for this would be a shade more clear. But it's really
just smoke-and-mirrors. Whether all that data is a struct or raw
params means little.

More information about the pacman-dev mailing list