|
From: | Paolo Bonzini |
Subject: | Re: pipe-filter: nice work |
Date: | Mon, 25 Jul 2011 17:24:45 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 |
On 07/23/2011 11:19 PM, Bruno Haible wrote:
> The only inelegance is having > to code up a struct type to pass around the privdata argument even for > something as simple as passing data in and reading it out again.That's life, in C. A callback consists of a function pointer plus a privdata pointer, which is declared as 'void *' but actually some specialized pointer.
You could pass a typed structure and let the callee use container_of or similar macros.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |