[D3D9 1/8] Remove const qualifier on state_test data
ivg231 at gmail.com
Wed Oct 4 21:54:41 CDT 2006
Alexandre Julliard wrote:
> Ivan Gyurdiev <ivg231 at gmail.com> writes:
>> Type: Cleanup
>> The const qualifier is unnecessarily restrictive.
>> I intend to allocate and free such data on the heap in a future patch
>> (in addition to the current const data).
> I still don't see any reason for this. Please fix your code to not
> require that change by simply saving the pointer you are going to free
> somewhere else.
It's already marked const in the parameters of the set and get
functions, which means it can't be modified there (arg 3):
+ void (*set_handler) (IDirect3DDevice9* device, const struct
state_test* test, const void* data_in);
+ void (*get_handler) (IDirect3DDevice9* device, const struct
state_test* test, const void* data_out);
I guess you get protection against modifying it in the init and teardown
functions (which is never going to happen - those are two functions you
write at the same time, located directly next to each other)... at the
cost of significantly reducing code readability. I would have to define
a "test_allocations" structure or something like that, and put the very
same pointers in there, and then free them at the end...
More information about the wine-devel