-
Eric Blake authored
As promised in several previous patches, this is a mechanical change that does two things to every filter: instead of using void* for callback parameters, we now use an actual opaque type (which helps avoid errors of passing the wrong pointer around), and instead of passing identical pointers for next_ops and nxdata, we pass a single parameter. The changes in docs and server are manual, but the bulk of the changes in filters were driven by: $ cat s.cocci @rule1@ identifier fn, next_ops, nxdata; typedef nbdkit_next; @@ fn( - struct nbdkit_next_ops *next_ops, void *nxdata + nbdkit_next *next ,...) { ... } @@ identifier rule1.next_ops, rule1.nxdata; identifier op; expression list args; expression exp; @@ ( -next_ops->op (nxdata, args) +next->op (next, args) | -exp (next_ops, nxdata, args) +exp (next, args) ) @@ identifier fn, next, nxdata; @@ -fn(struct nbdkit_next_open *next, void *nxdata +fn(struct nbdkit_next_open *next, nbdkit_context *nxdata ,...) { ... } @@ identifier fn, next; identifier nxdata != handle; type nbdkit_foo; @@ fn( - nbdkit_foo *next, void *nxdata + nbdkit_foo *next, nbdkit_backend *nxdata , ...) { ... } $ spatch --sp-file s.cocci --in-place --no-show-diff \ filters/ tests/test-layers-filter.c $ git grep -l 'next->[a-z_]*(' filters/ | \ xargs sed -i 's/next->\([a-z_]*\)(/next->\1 (/g' Followed by manual touchups until everything compiled.
5128fdb1