Damdoshi / LibLapin

Multimedia library for rookies and prototyping
http://hangedbunnystudio.com
Other
36 stars 9 forks source link

Bunny configuration does not allow user to create an empty array #24

Open Damdoshi opened 3 months ago

Damdoshi commented 3 months ago

Example from tadventure:

I need to pass argc/argv couple to a function. There is NO parameter to send, so I set argc to 0, achieved by bunny_configuration_setf(cnf, argc, "[0]"); And then, when I need to create an empty array for argv: bunny_configuration_setf(cnf, ????, "[1]"); NULL is used to delete a node. So it can't be NULL.

To make it works in tadventure, I had to write bunny_configuration_setf(cnf, "", "[1][0]"); so the array is not empty but have a size of 1. Considering argc is here to indicates the size of the array, it is not big deal for tadventure, but in any other case, this would be broken.

Maybe create a bunny_configuration_deletef and use NULL in setf as a way to create node without setting a value... or create a macro, with a value of -1 casted to void to mark that.