src/topology/parser.c: drop duplicate safe_strtol_base

safe_strtol_base is defined twice since
f547b2e35f
and
5fab157a59
resulting in the following build failure when alsa-utils is built
statically:

checking for snd_tplg_new in -latopology... no
configure: error: No linkable libatopology was found.

because safe_strtol_base is defined twice:

configure:7776: checking for snd_tplg_new in -latopology
configure:7801: /home/buildroot/autobuild/instance-2/output-1/host/bin/arm-linux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0  -static -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -static conftest.c -latopology  -lasound  -lasound -lm  -lpthread  >&5
/home/buildroot/autobuild/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/9.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-2/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libasound.a(conf.o): in function `safe_strtol_base':
conf.c:(.text+0x1600): multiple definition of `safe_strtol_base'; /home/buildroot/autobuild/instance-2/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libatopology.a(parser.o):parser.c:(.text+0x130): first defined here

Fixes:
 - http://autobuild.buildroot.org/results/08d028004090b2a8292f03910cb9bf80a73ac804

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
This commit is contained in:
Fabrice Fontaine 2022-01-01 17:58:18 +01:00
parent 0a1fd4b8f7
commit ad84766802
4 changed files with 7 additions and 4 deletions

View file

@ -414,7 +414,7 @@ static int write_hex(char *buf, char *str, int width)
void *p = &val; void *p = &val;
errno = 0; errno = 0;
if (safe_strtol_base(str, &val, 16) < 0) if (tplg_safe_strtol_base(str, &val, 16) < 0)
return -EINVAL; return -EINVAL;
switch (width) { switch (width) {

View file

@ -43,7 +43,7 @@ static int lookup_ops(const char *c)
} }
/* cant find string name in our table so we use its ID number */ /* cant find string name in our table so we use its ID number */
i = safe_strtol(c, &ret); i = tplg_safe_strtol(c, &ret);
if (i < 0) { if (i < 0) {
SNDERR("wrong kcontrol ops value string '%s'", c); SNDERR("wrong kcontrol ops value string '%s'", c);
return i; return i;

View file

@ -24,7 +24,7 @@
/* /*
* Safe strtol call * Safe strtol call
*/ */
int safe_strtol_base(const char *str, long *val, int base) int tplg_safe_strtol_base(const char *str, long *val, int base)
{ {
char *end; char *end;
long v; long v;
@ -59,7 +59,7 @@ int tplg_get_integer(snd_config_t *n, int *val, int base)
err = snd_config_get_string(n, &str); err = snd_config_get_string(n, &str);
if (err < 0) if (err < 0)
return err; return err;
err = safe_strtol_base(str, &lval, base); err = tplg_safe_strtol_base(str, &lval, base);
if (err < 0) if (err < 0)
return err; return err;
goto __retval; goto __retval;

View file

@ -407,6 +407,9 @@ int tplg_save_stream_caps(snd_tplg_t *tplg, struct tplg_elem *elem,
int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem, int tplg_save_dai(snd_tplg_t *tplg, struct tplg_elem *elem,
struct tplg_buf *dst, const char *pfx); struct tplg_buf *dst, const char *pfx);
int tplg_safe_strtol_base(const char *str, long *val, int base);
static inline int tplg_safe_strtol(const char *str, long *val) { return tplg_safe_strtol_base(str, val, 0); }
int tplg_decode_template(snd_tplg_t *tplg, int tplg_decode_template(snd_tplg_t *tplg,
size_t pos, size_t pos,
struct snd_soc_tplg_hdr *hdr, struct snd_soc_tplg_hdr *hdr,