mynewt-core
mynewt-core copied to clipboard
config functions don't work when the string is a constant
Some of the config module functions (e.g. conf_get_value) don't work when the string is a const. Because these functions internally use strtok_r, which modifies the original string, if the string passed into the function is a const (such as a char * string literal), the function will fail to tokenize the string properly. The workaround in the user code is to copy the config name to a temporary variable and pass that into the function.
Perhaps it might a good idea to have the config functions do this themselves internally, as it's not obvious in the documentation that this is the behaviour and it's a difficult bug to diagnose.