[lvm-devel] const correctness, first cut

Jim Meyering jim at meyering.net
Mon Aug 6 20:07:37 UTC 2007


Alasdair G Kergon <agk at redhat.com> wrote:
> On Mon, Aug 06, 2007 at 05:18:22PM +0200, Jim Meyering wrote:
>> I find it easier to read code that uses "const" whenever possible.
>
> All looks sane, thanks.
>
>>  		process_each_lv_in_vg(cmd, vg, NULL, NULL, NULL,
>> -				      &lvdisplay_full);
>> +				      (process_single_lv_fn_t)lvdisplay_full);
>
> Is there a nice way to avoid those casts?

This is where you wish for features of other languages.

I wrote an earlier iteration that instead added a new function,
process_each_lv_in_vg_ro (read-only), with the appropriate
signature for the fn-parameter, but IMHO, that was worse,
and besides, wasn't worth it, for just one use.




More information about the lvm-devel mailing list