]> git.alsa-project.org Git - alsa-lib.git/commitdiff
control: Use strcpy() instead of stpcpy()
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 17 Jul 2012 10:00:14 +0000 (15:30 +0530)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 Jul 2012 12:55:55 +0000 (14:55 +0200)
This allows us to build in environments that don't provide stpcpy().
This makes it necessary to traverse the string twice, but should not be
noticeable in clients since this function is very unlikely to be part of
a performance-critical path.

[coding style fixed by tiwai]

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/control/control.c

index a0965c6c901f8979cb1ebaaa54cb4a7979b1ae90..66277efe33df74043dd08dadfccfc06cad0a7193 100644 (file)
@@ -417,8 +417,10 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
        info->value.enumerated.names_ptr = (uintptr_t)buf;
        info->value.enumerated.names_length = bytes;
        p = buf;
-       for (i = 0; i < items; ++i)
-               p = stpcpy(p, names[i]) + 1;
+       for (i = 0; i < items; ++i) {
+               strcpy(p, names[i]);
+               p += strlen(names[i]) + 1;
+       }
 
        err = ctl->ops->element_add(ctl, info);