[PATCH v2 2/6] socketeutils: allow to pass a user data to the callback function of receive_responses()

Dmitry V. Levin ldv at altlinux.org
Mon Jun 12 22:32:53 UTC 2017

On Sun, Jun 11, 2017 at 04:42:28PM +0900, Masatake YAMATO wrote:
> Now I'm working on decoding the communication on Netlink GENERIC
> protocol.  For the task, many lines of receive_responses can be reused
> with two minor modifications. This is the second one.
> * socketutils.c (receive_responses): change the data type
> of parameter `proto_name' to `void *' from `const char *'
> to allow callee passing arbitrary data to the call backward
> function `parser'. In addition the parameter name is
> changed to `user_data'. To follow common convention, the
> parameter is passed to `parser' as its last argument.
> (unix_get, inet_get, netlink_get): Cast statically given
> the protocol name to `void *' to pass it to the call
> back function.
> (inet_parse_response,unix_parse_response,netlink_parse_response):
> Introduce a local variable `proto_name' to convert the data type
> of argument from `void *' to `const char*'.

Thanks, applied with the following editions:
- the order of receive_responses arguments is changed so that user_data
  is now the latest;
- renamed user_data to opaque_data.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170613/3bc56fb1/attachment.bin>

More information about the Strace-devel mailing list