Improved RF helper

This commit is contained in:
Xavier Arteaga 2020-09-16 18:38:06 +02:00 committed by Xavier Arteaga
parent 1afc137032
commit 759719ad55
1 changed files with 7 additions and 3 deletions

View File

@ -59,6 +59,10 @@ static inline int parse_string(char* args, const char* config_arg_base, int chan
{
int ret = SRSLTE_ERROR;
if (args == NULL) {
return ret;
}
char config_key[RF_PARAM_LEN] = {0};
char config_str[RF_PARAM_LEN] = {0};
char* config_ptr = NULL;
@ -112,12 +116,12 @@ static inline int parse_double(char* args, const char* config_arg_base, int chan
static inline int parse_uint32(char* args, const char* config_arg_base, int channel_index, uint32_t* value)
{
double tmp_value;
int ret = parse_double(args, config_arg_base, channel_index, &tmp_value);
char tmp_value[RF_PARAM_LEN] = {0};
int ret = parse_string(args, config_arg_base, channel_index, tmp_value);
// Copy parsed value only if was found, otherwise it keeps the default
if (ret == SRSLTE_SUCCESS) {
*value = tmp_value;
*value = (uint32_t)strtol(tmp_value, NULL, 10);
}
return ret;