Revert "src/topology/parser.c: drop duplicate safe_strtol_base"

This reverts commit 47252054b4.
This commit is contained in:
Fabrice Fontaine 2022-01-01 17:57:55 +01:00
parent 47252054b4
commit 0a1fd4b8f7

View file

@ -21,6 +21,25 @@
#include "list.h"
#include "tplg_local.h"
/*
* Safe strtol call
*/
int safe_strtol_base(const char *str, long *val, int base)
{
char *end;
long v;
if (!*str)
return -EINVAL;
errno = 0;
v = strtol(str, &end, base);
if (errno)
return -errno;
if (*end)
return -EINVAL;
*val = v;
return 0;
}
/*
* Get integer value
*/