FS#9504 - Simplify the FILENAME_SETTING macro, making its usage less error prone

Attached to Project: Rockbox
Opened by Alexander Levin (fml2) - Wednesday, 22 October 2008, 22:03 GMT
Last edited by Jonathan Gordon (jdgordon) - Thursday, 23 October 2008, 00:29 GMT
Task Type Patches
Category Applications
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The patch eliminates the last parameter (len) of the macro FILENAME_SETTING thus making it easier to use and at the same time less error prone. Before, the string size had to be written down twice: once in the definition of the setting (in setting.h) and then in the definition of how the setting is stored in the cfg file. Both sizes should match. But since all setting strings are defined as char arrays we can just use sizeof(), no need to explicitly specify the max length.

The max_length member (in struct filename_setting) could probably also be eliminated, but I wanted to make the patch as small as possible.
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Thursday, 23 October 2008, 00:29 GMT
Reason for closing:  Accepted
Additional comments about closing:  thanks