mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
module-rt{kit}: use spa_atoi32 instead of custom strtol
And duplicate the function into rtkit which had a similar but different approach to it. Let's get both to do the same here.
This commit is contained in:
parent
87a1e1534c
commit
696a4b22e9
2 changed files with 12 additions and 7 deletions
|
|
@ -150,10 +150,7 @@ static int get_default_int(struct pw_properties *properties, const char *name, i
|
||||||
bool set_default = true;
|
bool set_default = true;
|
||||||
|
|
||||||
if ((str = pw_properties_get(properties, name)) != NULL) {
|
if ((str = pw_properties_get(properties, name)) != NULL) {
|
||||||
char *endptr;
|
if (spa_atoi32(str, &val, 10))
|
||||||
|
|
||||||
val = (int)strtol(str, &endptr, 10);
|
|
||||||
if (*endptr == '\0')
|
|
||||||
set_default = false;
|
set_default = false;
|
||||||
else
|
else
|
||||||
pw_log_warn("invalid integer value '%s' of property %s, using default (%d) instead", str, name, def);
|
pw_log_warn("invalid integer value '%s' of property %s, using default (%d) instead", str, name, def);
|
||||||
|
|
|
||||||
|
|
@ -501,12 +501,20 @@ static int get_default_int(struct pw_properties *properties, const char *name, i
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
const char *str;
|
const char *str;
|
||||||
if ((str = pw_properties_get(properties, name)) != NULL)
|
bool set_default = true;
|
||||||
val = atoi(str);
|
|
||||||
else {
|
if ((str = pw_properties_get(properties, name)) != NULL) {
|
||||||
|
if (spa_atoi32(str, &val, 10))
|
||||||
|
set_default = false;
|
||||||
|
else
|
||||||
|
pw_log_warn("invalid integer value '%s' of property %s, using default (%d) instead", str, name, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set_default) {
|
||||||
val = def;
|
val = def;
|
||||||
pw_properties_setf(properties, name, "%d", val);
|
pw_properties_setf(properties, name, "%d", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue