dabisu / sakura

GTK/VTE based terminal emulator
https://launchpad.net/sakura
GNU General Public License v2.0
176 stars 22 forks source link

palettes_names: correct array size calculation #29

Closed buhman closed 1 year ago

buhman commented 1 year ago

sizeof(&palettes_names) only works currently by coincidence. On 64-bit systems the size of a pointer is 8, minus 1 is 7 which is the current number of palettes.

This divides the total size of the entire array by the size of each element, which is the idiomatic way to find "number of elements of initialized array" in C.

dabisu commented 1 year ago

Thanks buhman, good catch.