test: BSD-like fixes

- rename devname -> pcmdev, it conflicts *BSD <stdlib.h> function
- replace <values.h> -> <limits.h> and fix K&R style related warning
- use config.h to determine include <malloc.h>
- add OpenBSD support and fix printf() warning
- fix warning

Fixes: https://github.com/alsa-project/alsa-lib/pull/298
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
SASANO Takayoshi 2023-02-02 16:00:45 +09:00 committed by Jaroslav Kysela
parent 3b4cdbdf19
commit 44705e3a20
6 changed files with 26 additions and 13 deletions

View file

@ -37,7 +37,7 @@ static char mode_suffix[] = {
'a', 's', 'h', 't', 'd', 'r'
};
static const char *devname = "default";
static const char *pcmdev = "default";
static int stream = SND_PCM_STREAM_PLAYBACK;
static int num_threads = 1;
static int periodsize = 16 * 1024;
@ -127,7 +127,7 @@ static int parse_options(int argc, char **argv)
while ((c = getopt(argc, argv, "D:r:f:p:b:s:t:m:vq")) >= 0) {
switch (c) {
case 'D':
devname = optarg;
pcmdev = optarg;
break;
case 'r':
rate = atoi(optarg);
@ -213,9 +213,9 @@ int main(int argc, char **argv)
if (parse_options(argc, argv))
return 1;
err = snd_pcm_open(&pcm, devname, stream, 0);
err = snd_pcm_open(&pcm, pcmdev, stream, 0);
if (err < 0) {
fprintf(stderr, "cannot open pcm %s\n", devname);
fprintf(stderr, "cannot open pcm %s\n", pcmdev);
return 1;
}