Sowmini.Varadhan at Sun.COM wrote:
>>> typedef struct foo_s {
>>>     char **prop_val;
>>>     int *val_cnt
>>> }foo_t; 
>>>
>>> foo_t prop;
>>> val_desc_t v = {NULL, &prop};
>>>
>>> It creates extra indirections in the wrapper function, but
>>> val_desc_t is a bit more flexible for me, because I need to pass in
>>> 4 pieces of info: link_name, prop_name, prop_val, an val_cnt
>>>
>> I don't quite understand the above example. As I understand, if there is 
>> only val_desc_t, then val_cnt is 1.
> 
> I think we are getting mixed up between the number of prop_val elements
> and the number of val_desc elements.  I thought the function prototype
> you had for pd_getf_t was the former (i.e., #prop_val). Is that not
> the case? 
> 
Note that there is no confusion: one val_desc conresponds to one prop_val 
and to one string. So that the number of val_desc will be the same as the 
number of the prop_val and the number of the string.

Unless it doesn't work for your case. If not, please provide an example then 
we can discuss how to solve it.

> If yes, then a call of the form
> 
>   (*pd_get)((char *)arg1, (char **)arg2, (uint_t *)arg3) 
> 
> would translate to
> 
>   (*my_pd_get)(arg1, (val_desc_t *)my_arg2, (uint_t *)my_arg3)
> 
> where
>   *my_arg3 = 1, 
>   my_arg2.prop_val = arg2;
>   my_arg2.val_cnt = arg3;
> 
> Does that make sense? 
> 
I don't understand, if you have "arg3" values, why *my_arg3 is set to 1?

Thanks
- Cathy

Reply via email to