On Sun, Mar 5, 2017 at 7:20 PM, Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> wrote: > A backend may need to know the size or the type of an > argument and there is no easy way to access to this info. Actually, there is a way to do it with two list iterative. Will comment it on the next patch that use the get_nth1_arg(). > +static inline struct symbol *get_nth1_arg(struct symbol *fn, int idx) > +{ > + struct symbol_list *args = fn->ctype.base_type->arguments; > + struct symbol *arg; > + int i = 0; > + FOR_EACH_PTR(args, arg) { > + if (++i == idx) > + return arg; > + } END_FOR_EACH_PTR(arg); > + > + return NULL; As I said, I am not sure this is necessary in the particular case. However, the nth list entry is some what useful. If we add that, we should add it to ptrlist.c. Then every time of ptr_list can have it. Also, there is no need to do "++i", it should use the list->nr to skip over the list node for the case where n is relative large. Then only do the counting inside the list node. If list is packed, it is every easier, we can just return from the index. Depend on we want to allow unpacked list or not. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html