From 2a155268c2a97c860a41dac6580f0478b7a97c84 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 14 Sep 2022 20:32:28 +0300 Subject: [PATCH] move xmp_strdup() into a new util.c source module. --- src/Makefile.am | 3 +-- src/main.c | 10 ---------- src/util.c | 24 ++++++++++++++++++++++++ vc/xmp.vcproj | 4 ++++ watcom.mif | 2 +- 5 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 src/util.c diff --git a/src/Makefile.am b/src/Makefile.am index 593d19b..b65eb85 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,7 @@ bin_PROGRAMS = xmp xmp_SOURCES = \ commands.c common.h delay.c getopt_long.h list.h getopt_long.c info.c \ main.c options.c read_config.c sound.c sound.h sound_file.c sound_null.c \ - sound_wav.c sound_aiff.c terminal.c xmp_version.h + sound_wav.c sound_aiff.c terminal.c util.c xmp_version.h xmp_LDADD = ${LIBXMP_LIBS} xmp_LDFLAGS = ${XMP_DARWIN_LDFLAGS} @@ -90,7 +90,6 @@ endif if SOUND_OS2DART xmp_SOURCES += sound_dart.c -# for mciSendCommand() xmp_LDADD += -lmmpm2 endif diff --git a/src/main.c b/src/main.c index b2096bd..2e3d7d5 100644 --- a/src/main.c +++ b/src/main.c @@ -44,16 +44,6 @@ static struct sound_driver *sound; static unsigned int foreground_in, foreground_out; static int refresh_status; -char *xmp_strdup(const char *in) -{ - size_t len = strlen(in) + 1; - char *out = (char *) malloc(len); - if (out) { - memcpy(out, in, len); - } - return out; -} - int report(const char *fmt, ...) { va_list a; diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..4ebe0fe --- /dev/null +++ b/src/util.c @@ -0,0 +1,24 @@ +/* Extended Module Player + * Copyright (C) 1996-2022 Claudio Matsuoka and Hipolito Carraro Jr + * + * This file is part of the Extended Module Player and is distributed + * under the terms of the GNU General Public License. See the COPYING + * file for more information. + */ + +#include +#include +#include +#include +#include "common.h" + +char *xmp_strdup(const char *in) +{ + size_t len = strlen(in) + 1; + char *out = (char *) malloc(len); + if (out) { + memcpy(out, in, len); + } + return out; +} + diff --git a/vc/xmp.vcproj b/vc/xmp.vcproj index 9c79acd..9e0ceb5 100644 --- a/vc/xmp.vcproj +++ b/vc/xmp.vcproj @@ -163,6 +163,10 @@ RelativePath="..\src\terminal.c" > + + diff --git a/watcom.mif b/watcom.mif index e024625..03a7000 100644 --- a/watcom.mif +++ b/watcom.mif @@ -16,7 +16,7 @@ LIBS+= $(LIBXMP) AOUT=xmp.exe COMPILE=$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -OBJ = commands.obj delay.obj getopt_long.obj info.obj main.obj options.obj read_config.obj sound.obj sound_aiff.obj sound_file.obj sound_null.obj sound_wav.obj terminal.obj +OBJ = commands.obj delay.obj getopt_long.obj info.obj main.obj options.obj read_config.obj sound.obj sound_aiff.obj sound_file.obj sound_null.obj sound_wav.obj terminal.obj util.obj all: $(AOUT)