On Tue, 2009-02-24 at 20:24 +0800, Nelson Castillo wrote: > Hi there. > > Is there a strlen-like function for pointers? I have this code: > > struct ts_filter_api **api_r = api; > int count = 0; > /* find out how many filters we need to create */ > while (*api_r) { > count++; > api_r++; > } > > and I would like to have it replaced with > > ptrlen(api); Nobody stops you from creating such a function just for your driver/module. I don't have numbers but if there is frequent use of such a function, people will probably store (and update) the count somewhere to avoid the frequent loops. And if that is not used often, probably almost no one needs it. > If it doesn't exist -- do you see something that could go wrong with a > ptrlen function? Would upstream like it? There is only one possibility: Just try and propose it. Create such a function for your part, send a patch and plain simply ask if people feel that the function should move to the lib/ directory (or whereever). Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ