Removed stdlib.h from osdcomm.h.

- Added #include stdlib.h where now necessary
Fixed Solaris build
Fixed building unidasm for OSD=sdl on win32
This commit is contained in:
Couriersud 2010-01-17 19:27:03 +00:00
parent 89d20f9866
commit 269e2cf4fc
15 changed files with 54 additions and 16 deletions

View File

@ -45,7 +45,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <stdlib.h>
/***************************************************************************

View File

@ -269,7 +269,7 @@ static void CustomApplicationMain (int argc, char **argv)
if (arg == NULL)
return FALSE;
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
newargv = (char **) SDL_realloc(gArgv, sizeof (char *) * (gArgc + 2));
if (newargv == NULL)
{
SDL_free(arg);

View File

@ -44,7 +44,7 @@ extern "C" int _tmain(int argc, TCHAR **argv)
#endif
/* convert arguments to UTF-8 */
utf8_argv = (char **) malloc(argc * sizeof(*argv));
utf8_argv = (char **) osd_malloc(argc * sizeof(*argv));
if (utf8_argv == NULL)
return 999;
for (i = 0; i < argc; i++)
@ -59,8 +59,8 @@ extern "C" int _tmain(int argc, TCHAR **argv)
/* free arguments */
for (i = 0; i < argc; i++)
free(utf8_argv[i]);
free(utf8_argv);
osd_free(utf8_argv[i]);
osd_free(utf8_argv);
#ifdef MALLOC_DEBUG
{

View File

@ -65,6 +65,7 @@ endif
# GTK_INSTALL_ROOT = y:/couriersud/win/gtk-32
###########################################################################
################## END USER-CONFIGURABLE OPTIONS ######################
###########################################################################
@ -154,7 +155,7 @@ endif
ifeq ($(TARGETOS),solaris)
BASE_TARGETOS = unix
DEFS += -DNO_AFFINITY_NP
DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
SYNC_IMPLEMENTATION = tc
endif
@ -198,6 +199,8 @@ SYNC_IMPLEMENTATION = win32
NO_X11 = 1
DEFS += -DSDLMAME_WIN32 -DX64_WINDOWS_ABI
LIBGL = -lopengl32
# needed for unidasm
LDFLAGS += -Wl,--allow-multiple-definition
# do we have GTK ?
ifndef GTK_INSTALL_ROOT
@ -492,7 +495,7 @@ testkeys$(EXE): $(TESTKEYSOBJS) $(LIBUTIL) $(LIBOCORE) $(SDLUTILMAIN)
#-------------------------------------------------
$(OSDCLEAN):
rm -f .depend_*
@rm -f .depend_*
#-------------------------------------------------
# various support targets
@ -511,19 +514,18 @@ EXCLUDES = -x "*/.svn/*"
zip:
zip -rq ../mame_$(BUILD_VERSION).zip $(DISTFILES) $(EXCLUDES)
DEPEND = .depend_$(EMULATOR)
DEPENDFILE = .depend_$(EMULATOR)
$(DEPEND):
rm -f $(DEPEND)
makedepend:
@echo Generating $(DEPENDFILE)
rm -f $(DEPENDFILE)
@for i in `find src -name "*.c"` ; do \
echo processing $$i; \
mt=`echo $$i | sed -e "s/\\.c/\\.o/" -e "s!^src/!$(OBJ)/!"` ; \
g++ -MM -MT $$mt $(CDEFS) $(CCOMFLAGS) $$i 2>/dev/null \
| sed -e "s!$$i!!g" >> $(DEPEND) ; \
| sed -e "s!$$i!!g" >> $(DEPENDFILE) ; \
done
depend: $(DEPEND)
-include $(DEPEND)
-include $(DEPENDFILE)
endif

View File

@ -9,11 +9,17 @@
//
//============================================================
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#ifdef SDLMAME_LINUX
#define __USE_LARGEFILE64
#endif
#ifndef SDLMAME_BSD
#ifdef _XOPEN_SOURCE
#undef _XOPEN_SOURCE
#endif
#define _XOPEN_SOURCE 500
#endif
@ -70,7 +76,7 @@ static osd_dir_entry_type get_attributes_stat(const char *file)
#else
struct stat64 st;
if(stat64(file, &st))
return 0;
return ENTTYPE_NONE;
#endif
#ifdef SDLMAME_WIN32

View File

@ -9,11 +9,17 @@
//
//============================================================
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#ifdef SDLMAME_LINUX
#define __USE_LARGEFILE64
#endif
#ifndef SDLMAME_BSD
#ifdef _XOPEN_SOURCE
#undef _XOPEN_SOURCE
#endif
#define _XOPEN_SOURCE 500
#endif

View File

@ -262,7 +262,7 @@ static int setenv(const char *name, const char *value, int overwrite)
if (getenv(name) != NULL)
return 0;
}
buf = (char *) malloc(strlen(name)+strlen(value)+2);
buf = (char *) osd_malloc(strlen(name)+strlen(value)+2);
sprintf(buf, "%s=%s", name, value);
result = putenv(buf);

View File

@ -127,7 +127,11 @@ void *osd_alloc_executable(size_t size)
void osd_free_executable(void *ptr, size_t size)
{
#ifdef SDLMAME_SOLARIS
munmap((char *)ptr, size);
#else
munmap(ptr, size);
#endif
}
//============================================================

View File

@ -27,6 +27,18 @@
#if defined(__sun__) && defined(__svr4__)
#define SDLMAME_SOLARIS 1
//#undef _XOPEN_SOURCE
#undef _XOPEN_SOURCE_EXTENDED
#undef _XPG6
#undef _XPG5
#undef _XPG4_2
#if 1
#undef _XOPEN_SOURCE
#undef _XOPEN_VERSION
#define _XOPEN_SOURCE
#define _XOPEN_VERSION 4
#endif
#elif defined(__irix__) || defined(__sgi)
#define SDLMAME_IRIX 1

View File

@ -22,6 +22,9 @@ int sdl_num_processors = 0;
#else
// FIXME: remove this after malloc->osd_malloc
#include <stdlib.h>
#include "osdcore.h"
#include "osinline.h"

View File

@ -43,6 +43,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
// MAMEOS headers
#include "strconv.h"

View File

@ -44,6 +44,7 @@
#include <windows.h>
#include <winioctl.h>
#include <tchar.h>
#include <stdlib.h>
// MAME headers
#include "osdcore.h"

View File

@ -42,6 +42,7 @@
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
// MAME headers
#include "osdcore.h"

View File

@ -43,6 +43,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#include <stdlib.h>
// MAMEOS headers
#include "winutf8.h"

View File

@ -44,6 +44,7 @@
#include <windows.h>
#include <process.h>
#include <tchar.h>
#include <stdlib.h>
#ifdef __GNUC__
#include <stdint.h>