dterrahe / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
2 stars 0 forks source link

more regexp boiler plate reduction #29

Closed dterrahe closed 2 months ago

dterrahe commented 3 months ago

improve consistency and reduce unnecessary duplication

@turbogit @jenshannoschwalm @ralfbrown

jenshannoschwalm commented 3 months ago

Whow, great simplification/maintenance stuff! Much easier to read for me, all that user_data stuff gone!

dterrahe commented 3 months ago

Removed more explicit casts from void* in initializations of variables to the same type.

This is not needed in c and potentially dangerous because it silently removes const. Even cases where it is "fine" hide (by their presence everywhere) the cases where something is really happening. This undermines the whole usefulness of const marking in the first place; we have structures containing const members that are always cast to non-const before use... Look at some of the examples returned by dt_(.*?)_t \*(.*?) = \(dt_\1_t \*\)(.*?)-> There are a bunch of cases where one line marks a pointer const with the next declaring an additional pointer that removes that constness.

c++ requires these casts, but checks they don't remove const and offers the (better) alternative of using templates to enforce the datatypes carried inside generic structures.

@turbogit

dterrahe commented 2 months ago

Rebasing creates a mess; opening new local PR