so I found myself writing this macro, and using it 4 times.

+#define for_each_boxed_veclen(_box, _vec, _len, _ct, _curs) \
+ for (_ct = 0, _curs = _box->_vec; _ct < _box->_len; _ct++, _curs++)

- for (i = 0, cm = di->classes; i < di->num_classes; i++, cm++) {
+ for_each_boxed_veclen(di, classes, num_classes, i, cm) {

Qs:

does it exist by another name already ?

is it worth having generally ?

are there better ways to do it ?

fwiw, it does sound semantically connected to __counted_by()  attribute

struct Ntuple {
  int len;
  struct tuple **vector __counted_by(len);
}

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to