Cleanup of memlib and its use: removed legacy handle code, moved memory alloc funcs into memlib.h
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3222 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
//#include "libs/misc.h"
|
||||
//#include "port.h"
|
||||
#include "types.h"
|
||||
#include "port.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "libs/decomp/lzh.h"
|
||||
#include "lzh.h"
|
||||
#include "libs/reslib.h"
|
||||
|
||||
PLZHCODE_DESC _lpCurCodeDesc;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#define _LZH_H
|
||||
|
||||
#include "libs/declib.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
/* LZSS Parameters */
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "config.h"
|
||||
#include "filintrn.h"
|
||||
#include "libs/compiler.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/log.h"
|
||||
|
||||
#ifdef HAVE_DRIVE_LETTERS
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "config.h"
|
||||
#include "types.h"
|
||||
#include "filintrn.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/log.h"
|
||||
|
||||
static int copyError(uio_Handle *srcHandle, uio_Handle *dstHandle,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "port.h"
|
||||
#include "libs/compiler.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
static char *tempDirName;
|
||||
uio_DirHandle *tempDir;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#define _CONTEXT_H
|
||||
|
||||
#include "tfb_draw.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
typedef UWORD FBK_FLAGS;
|
||||
#define FBK_DIRTY (1 << 0)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "tfb_draw.h"
|
||||
#include "gfxother.h"
|
||||
#include <math.h>
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef _FONT_H
|
||||
#define _FONT_H
|
||||
|
||||
#include "libs/memlib.h"
|
||||
|
||||
#define MAX_DELTAS 100
|
||||
|
||||
typedef struct FontPage
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "gfxintrn.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/graphics/drawcmd.h"
|
||||
#include "libs/misc.h"
|
||||
// for TFB_DEBUG_HALT
|
||||
|
||||
DISPLAY_INTERFACE *_pCurDisplay; //Not a function. Probably has to be initialized...
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libs/gfxlib.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
// driver for TFB_InitGraphics
|
||||
enum
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "libs/file.h"
|
||||
#include "libs/reslib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "../font.h"
|
||||
#include "primitives.h"
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "libs/graphics/sdl/primitives.h"
|
||||
#include "libs/graphics/tfb_draw.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "rotozoom.h"
|
||||
#include "options.h"
|
||||
#include "types.h"
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "libs/graphics/drawcmd.h"
|
||||
#include "libs/graphics/sdl/dcqueue.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
// for TFB_DEBUG_HALT
|
||||
|
||||
|
||||
static RecursiveMutex DCQ_Mutex;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "port.h"
|
||||
#include "rotozoom.h"
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "port.h"
|
||||
#include "libs/uio.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/vidlib.h"
|
||||
#include SDL_INCLUDE(SDL_thread.h)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include SDL_INCLUDE(SDL_error.h)
|
||||
#include SDL_INCLUDE(SDL_rwops.h)
|
||||
#include SDL_IMAGE_INCLUDE(SDL_image.h)
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "tfb_draw.h"
|
||||
#include "drawcmd.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
static const HOT_SPOT NullHs = {0, 0};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "libs/input/input_common.h"
|
||||
#include "libs/input/sdl/vcontrol.h"
|
||||
#include "libs/input/sdl/keynames.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/file.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/reslib.h"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "vcontrol.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "keynames.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/reslib.h"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
# include "list.h"
|
||||
#endif
|
||||
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#define malloc HMalloc
|
||||
#define free HFree
|
||||
#define realloc HRealloc
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define RANDOM2_INTERNAL
|
||||
#include "random.h"
|
||||
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
#define A 16807 /* a relatively prime number -- also M div Q */
|
||||
|
||||
+7
-37
@@ -19,45 +19,15 @@
|
||||
#ifndef _MEMLIB_H
|
||||
#define _MEMLIB_H
|
||||
|
||||
#include "libs/compiler.h"
|
||||
#include "types.h"
|
||||
|
||||
extern BOOLEAN mem_init (void);
|
||||
extern BOOLEAN mem_uninit (void);
|
||||
extern bool mem_init (void);
|
||||
extern bool mem_uninit (void);
|
||||
|
||||
#ifdef LEGACY_HANDLE_ALLOCATOR
|
||||
|
||||
#define NULL_HANDLE (MEM_HANDLE)(0L)
|
||||
|
||||
typedef signed long MEM_SIZE;
|
||||
|
||||
typedef SWORD MEM_HANDLE;
|
||||
typedef UWORD MEM_FLAGS;
|
||||
|
||||
#define DEFAULT_MEM_FLAGS (MEM_FLAGS)0
|
||||
#define MEM_PRIMARY (MEM_FLAGS)(1 << 8)
|
||||
#define MEM_ZEROINIT (MEM_FLAGS)(1 << 9)
|
||||
#define MEM_GRAPHICS (MEM_FLAGS)(1 << 10)
|
||||
#define MEM_SOUND (MEM_FLAGS)(1 << 11)
|
||||
|
||||
typedef struct mem_header {
|
||||
MEM_HANDLE handle;
|
||||
} _ALIGNED_ANY MEM_HEADER;
|
||||
// _ALIGNED_ANY adds padding to the end of MEM_HEADER, so that the following
|
||||
// address is aligned for any object (if the address of the MEM_HEADER
|
||||
// itself is aligned for any object).
|
||||
|
||||
#define GET_MEM_HEADER(addr) ((MEM_HEADER *) \
|
||||
(((char *) addr) - sizeof (MEM_HEADER)))
|
||||
|
||||
extern MEM_HANDLE mem_allocate (MEM_SIZE size, MEM_FLAGS flags);
|
||||
extern BOOLEAN mem_release (MEM_HANDLE handle);
|
||||
|
||||
extern void* mem_lock (MEM_HANDLE handle);
|
||||
extern BOOLEAN mem_unlock (MEM_HANDLE handle);
|
||||
|
||||
extern MEM_SIZE mem_get_size (MEM_HANDLE handle);
|
||||
|
||||
#endif /* LEGACY_HANDLE_ALLOCATOR */
|
||||
extern void *HMalloc (int size);
|
||||
extern void HFree (void *p);
|
||||
extern void *HCalloc (int size);
|
||||
extern void *HRealloc (void *p, int size);
|
||||
|
||||
#endif /* _MEMLIB_H */
|
||||
|
||||
|
||||
+13
-545
@@ -20,555 +20,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
//#include "3d.h"
|
||||
//#include "tool.h"
|
||||
//#include "utils.h"
|
||||
//#include "pcwin.h"
|
||||
#include "libs/compiler.h"
|
||||
#ifdef LEGACY_HANDLE_ALLOCATOR
|
||||
#include "libs/threadlib.h"
|
||||
#endif
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
#ifdef LEGACY_HANDLE_ALLOCATOR
|
||||
|
||||
#define GetToolFrame() 1
|
||||
|
||||
//#define MEM_DEBUG
|
||||
|
||||
#ifdef MEM_DEBUG
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#define LEAK_DEBUG
|
||||
|
||||
#ifdef LEAK_DEBUG
|
||||
BOOLEAN leak_debug;
|
||||
int leak_idx = -1;
|
||||
int leak_size = -1;
|
||||
#endif
|
||||
static Mutex _MemoryLock;
|
||||
|
||||
//#define MAX_EXTENTS 100000
|
||||
#define MAX_EXTENTS (MEM_HANDLE) 32766
|
||||
// Changed to 32766 to get rid of warnings that an expression
|
||||
// 'h <= MAX_EXTENTS' is always true due to limited range of
|
||||
// MEM_HANDLE.
|
||||
|
||||
/* Keep track of memory allocations. */
|
||||
|
||||
typedef struct _szMemoryNode {
|
||||
void *memory;
|
||||
struct _szMemoryNode *next;
|
||||
MEM_HANDLE handle;
|
||||
MEM_SIZE size;
|
||||
int refcount;
|
||||
} szMemoryNode;
|
||||
|
||||
static szMemoryNode extents[MAX_EXTENTS];
|
||||
static szMemoryNode *freeListHead = NULL;
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** CheckMemory()
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Checks integrity of memory allocation: diagnostic only.
|
||||
** Either aborts or spits messages to stdout if there's a
|
||||
** problem.
|
||||
**
|
||||
** INPUT
|
||||
**
|
||||
** OUTPUT
|
||||
**
|
||||
** HISTORY
|
||||
** 04-Sept-96:AKL Creation.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
#ifdef MEM_DEBUG
|
||||
|
||||
void CheckMemory(void)
|
||||
{
|
||||
// Send all reports to STDOUT
|
||||
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
|
||||
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
|
||||
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
|
||||
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
|
||||
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
|
||||
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
|
||||
|
||||
_CrtCheckMemory();
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** mem = SafeMalloc (coreSize, diagnostic)
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Mallocs the required memory. If the malloc fails, the game
|
||||
** is killed with a diagnostic string.
|
||||
**
|
||||
** INPUT
|
||||
** int coreSize = How much memory to malloc (in bytes).
|
||||
** char *diagnostic = String identifying the caller.
|
||||
**
|
||||
** OUTPUT
|
||||
** void *mem = Ptr to memory. Never returns NULL.
|
||||
**
|
||||
** HISTORY
|
||||
** 14-Jan-08:Cleanups and conversion from MallocWithRetry.
|
||||
** 06-Nov-96:AKL Creation.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
static void *
|
||||
SafeMalloc (int bytes, char *diagStr)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = malloc (bytes);
|
||||
if (!ptr)
|
||||
{
|
||||
log_add (log_Fatal, "Malloc failed for %s. #Bytes %d.", diagStr, bytes);
|
||||
fflush (stderr);
|
||||
explode ();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
MEM_HANDLE
|
||||
mem_allocate (MEM_SIZE coreSize, MEM_FLAGS flags)
|
||||
{
|
||||
szMemoryNode *node;
|
||||
|
||||
LockMutex (_MemoryLock);
|
||||
|
||||
#ifdef MEM_DEBUG
|
||||
CheckMemory();
|
||||
#endif
|
||||
|
||||
if ((node = freeListHead) == NULL)
|
||||
log_add (log_Error, "mem_allocate: out of extents.");
|
||||
else if ((node->memory = MallocWithRetry (coreSize, "mem_allocate:")) == 0
|
||||
&& coreSize)
|
||||
log_add (log_Error, "mem_allocate: couldn't allocate %ld bytes.",
|
||||
coreSize);
|
||||
else
|
||||
{
|
||||
freeListHead = node->next;
|
||||
|
||||
node->size = coreSize;
|
||||
node->handle = node - extents + 1;
|
||||
node->refcount = 0;
|
||||
if (flags & MEM_ZEROINIT)
|
||||
memset (node->memory, 0, node->size);
|
||||
#ifdef LEAK_DEBUG
|
||||
if (leak_debug)
|
||||
{
|
||||
log_add (log_Debug, "alloc %d: %p, %lu", (int) node->handle,
|
||||
(void *) node->memory, node->size);
|
||||
// Preferred form:
|
||||
//log_add (log_Debug, "alloc %d: %#8" PRIxPTR ", %lu",
|
||||
// (int) node->handle, (intptr_t) node->memory, node->size);
|
||||
}
|
||||
if (node->handle == leak_idx && node->size == leak_size)
|
||||
node = node;
|
||||
if (node->size == leak_size)
|
||||
node = node;
|
||||
#endif /* LEAK_DEBUG */
|
||||
|
||||
UnlockMutex (_MemoryLock);
|
||||
return (node->handle);
|
||||
}
|
||||
|
||||
UnlockMutex (_MemoryLock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** size = mem_get_size(h)
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Returns the number of bytes in the given memory allocation.
|
||||
**
|
||||
** INPUT
|
||||
** int h = Handle to memory allocation.
|
||||
**
|
||||
** OUTPUT
|
||||
** int size = Number of bytes in allocation or zero on error.
|
||||
**
|
||||
** HISTORY
|
||||
** 09-Jul-96:AKL Creation. Original version in LIBS\MEMORY\DATAINFO.C.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
MEM_SIZE
|
||||
mem_get_size (MEM_HANDLE h)
|
||||
{
|
||||
LockMutex (_MemoryLock);
|
||||
if (h > 0 && h <= MAX_EXTENTS && extents[h - 1].handle == h)
|
||||
{
|
||||
UnlockMutex (_MemoryLock);
|
||||
return ((int)extents[h - 1].size);
|
||||
}
|
||||
UnlockMutex (_MemoryLock);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** done = mem_init(coreSize, pma, diskName)
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Initialize data that tracks allocation extents.
|
||||
**
|
||||
** INPUT
|
||||
** int coreSize = IGNORED!
|
||||
** int * pma = IGNORED!
|
||||
** PSTR diskName = IGNORED!
|
||||
**
|
||||
** OUTPUT
|
||||
** int done = TRUE.
|
||||
**
|
||||
** HISTORY
|
||||
** 09-Jul-96:AKL Creation. Original version in LIBS\MEMORY\INIT.C.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
BOOLEAN
|
||||
bool
|
||||
mem_init (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
_MemoryLock = CreateMutex ("memory lock", SYNC_CLASS_RESOURCE);
|
||||
LockMutex (_MemoryLock);
|
||||
|
||||
freeListHead = &extents[0];
|
||||
for (i=0; i<MAX_EXTENTS; i++)
|
||||
{
|
||||
extents[i].memory = NULL;
|
||||
extents[i].handle = -1;
|
||||
extents[i].next = &extents[i+1];
|
||||
extents[i].size = 0;
|
||||
}
|
||||
extents[MAX_EXTENTS-1].next = NULL;
|
||||
|
||||
UnlockMutex (_MemoryLock);
|
||||
|
||||
return TRUE;
|
||||
{ // This is a stub
|
||||
return true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** mem_uninit()
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Free allocated memory.
|
||||
**
|
||||
** INPUT
|
||||
**
|
||||
** OUTPUT
|
||||
**
|
||||
** HISTORY
|
||||
** 14-Oct-96:AKL Creation.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
BOOLEAN
|
||||
mem_uninit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
LockMutex (_MemoryLock);
|
||||
|
||||
for (i=0; i<MAX_EXTENTS; i++)
|
||||
{
|
||||
if (extents[i].handle != -1)
|
||||
{
|
||||
log_add (log_Debug, "LEAK: unreleased extent %d: %p, %lu",
|
||||
extents[i].handle, (void *) extents[i].memory,
|
||||
extents[i].size);
|
||||
// Preferred form:
|
||||
//log_add (log_Debug, "LEAK: unreleased extent %d: %#8" PRIxPTR
|
||||
// ", %lu", extents[i].handle,
|
||||
// (intptr_t) extents[i].memory, extents[i].size);
|
||||
fflush (stderr);
|
||||
extents[i].handle = -1;
|
||||
if (extents[i].memory)
|
||||
{
|
||||
free (extents[i].memory);
|
||||
extents[i].memory = 0;
|
||||
}
|
||||
}
|
||||
extents[i].size = 0;
|
||||
}
|
||||
freeListHead = 0;
|
||||
|
||||
UnlockMutex (_MemoryLock);
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** done = mem_release(h)
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Frees the given memory.
|
||||
**
|
||||
** INPUT
|
||||
** int h = Handle to memory to be released.
|
||||
**
|
||||
** OUTPUT
|
||||
** int done = TRUE.
|
||||
**
|
||||
** HISTORY
|
||||
** 09-Jul-96:AKL Creation. Original version in LIBS\MEMORY\ALLOC.C.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
BOOLEAN
|
||||
mem_release(MEM_HANDLE h)
|
||||
{
|
||||
if (h == 0)
|
||||
return (TRUE);
|
||||
|
||||
LockMutex (_MemoryLock);
|
||||
|
||||
--h;
|
||||
if (h < 0 || h >= MAX_EXTENTS)
|
||||
log_add (log_Debug, "LEAK: attempt to release invalid extent %d", h);
|
||||
else if (extents[h].handle == -1)
|
||||
log_add (log_Debug, "LEAK: attempt to release unallocated extent %d",h);
|
||||
else if (extents[h].refcount == 0)
|
||||
{
|
||||
#ifdef LEAK_DEBUG
|
||||
if (leak_debug)
|
||||
{
|
||||
log_add (log_Debug, "free %d: %p",
|
||||
extents[h].handle, (void *) extents[h].memory);
|
||||
// Preferred form:
|
||||
//log_add (log_Debug, "free %d: %#8" PRIxPTR,
|
||||
// extents[h].handle, (intptr_t) extents[h].memory);
|
||||
}
|
||||
#endif
|
||||
if (extents[h].memory)
|
||||
{
|
||||
free (extents[h].memory);
|
||||
extents[h].memory = 0;
|
||||
}
|
||||
extents[h].handle = -1;
|
||||
extents[h].next = freeListHead;
|
||||
freeListHead = &extents[h];
|
||||
UnlockMutex (_MemoryLock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UnlockMutex (_MemoryLock);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** memp = mem_lock (h)
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Converts a MEM_HANDLE into its equivalent pointer.
|
||||
**
|
||||
** INPUT
|
||||
** int h = Handle to memory to be accessed.
|
||||
**
|
||||
** OUTPUT
|
||||
** void * memp = Ptr to memory.
|
||||
**
|
||||
** HISTORY
|
||||
** 09-Jul-96:AKL Creation. Original version in LIBS\MEMORY\SIMPLE.C.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
void *
|
||||
mem_lock (MEM_HANDLE h)
|
||||
{
|
||||
LockMutex (_MemoryLock);
|
||||
|
||||
if (h > 0 && h <= MAX_EXTENTS && extents[h - 1].handle == h)
|
||||
{
|
||||
++extents[h - 1].refcount;
|
||||
UnlockMutex (_MemoryLock);
|
||||
return (extents[h - 1].memory);
|
||||
}
|
||||
|
||||
UnlockMutex (_MemoryLock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*FUNCTION
|
||||
**
|
||||
** SYNOPSIS
|
||||
** done = mem_simple_unaccess(h)
|
||||
**
|
||||
** DESCRIPTION
|
||||
** Drops the refcount on a piece of memory.
|
||||
**
|
||||
** INPUT
|
||||
** int h = Handle to memory to be unaccessed.
|
||||
**
|
||||
** OUTPUT
|
||||
** int done = TRUE.
|
||||
**
|
||||
** HISTORY
|
||||
** 09-Jul-96:AKL Creation. Original version in LIBS\MEMORY\SIMPLE.C.
|
||||
**
|
||||
** ASSUMPTIONS
|
||||
**
|
||||
**END*/
|
||||
|
||||
BOOLEAN
|
||||
mem_unlock (MEM_HANDLE h)
|
||||
{
|
||||
LockMutex (_MemoryLock);
|
||||
if (h > 0 && h <= MAX_EXTENTS && extents[h - 1].handle == h)
|
||||
{
|
||||
if (extents[h - 1].refcount)
|
||||
--extents[h - 1].refcount;
|
||||
UnlockMutex (_MemoryLock);
|
||||
return (1);
|
||||
}
|
||||
|
||||
UnlockMutex (_MemoryLock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void *
|
||||
_alloc_mem (int size)
|
||||
{
|
||||
void *p;
|
||||
int h;
|
||||
|
||||
h = mem_allocate (sizeof (MEM_HEADER) + size, DEFAULT_MEM_FLAGS);
|
||||
p = (void *)mem_lock (h);
|
||||
if (p)
|
||||
{
|
||||
((MEM_HEADER *) p)->handle = h;
|
||||
p = (char *)p + sizeof (MEM_HEADER);
|
||||
}
|
||||
|
||||
return (p);
|
||||
}
|
||||
|
||||
void *
|
||||
HMalloc (int size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (size == 0) return (0);
|
||||
|
||||
if ((p = _alloc_mem(size)) == NULL) {
|
||||
log_add (log_Fatal, "Fatal Error: HMalloc(): out of memory.");
|
||||
fflush (stderr);
|
||||
explode ();
|
||||
}
|
||||
return (p);
|
||||
}
|
||||
|
||||
void
|
||||
HFree (void *p)
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
MEM_HEADER *hdr;
|
||||
MEM_HANDLE h;
|
||||
|
||||
hdr = GET_MEM_HEADER(p);
|
||||
h = hdr->handle;
|
||||
mem_unlock (h);
|
||||
mem_release (h);
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
HCalloc (int size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = HMalloc (size);
|
||||
if (p)
|
||||
memset (p, 0, size);
|
||||
|
||||
return (p);
|
||||
}
|
||||
|
||||
void *
|
||||
HRealloc (void *p, int size)
|
||||
{
|
||||
void *np;
|
||||
int osize;
|
||||
|
||||
if ((np = _alloc_mem (size)) && p)
|
||||
{
|
||||
MEM_HEADER *hdr;
|
||||
MEM_HANDLE h;
|
||||
|
||||
hdr = GET_MEM_HEADER (p);
|
||||
h = hdr->handle;
|
||||
osize = mem_get_size (h) - sizeof (MEM_HEADER);
|
||||
if (size > osize)
|
||||
size = osize;
|
||||
memcpy (np, p, size);
|
||||
HFree (p);
|
||||
}
|
||||
|
||||
return (np);
|
||||
}
|
||||
|
||||
#else /* !LEGACY_HANDLE_ALLOCATOR */
|
||||
|
||||
BOOLEAN
|
||||
mem_init (void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
mem_uninit(void)
|
||||
{
|
||||
return (TRUE);
|
||||
bool
|
||||
mem_uninit (void)
|
||||
{ // This is a stub
|
||||
return true;
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -576,7 +42,8 @@ HMalloc (int size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (size == 0) return NULL;
|
||||
if (size == 0)
|
||||
return NULL;
|
||||
|
||||
if (size < 0)
|
||||
{
|
||||
@@ -585,7 +52,8 @@ HMalloc (int size)
|
||||
explode ();
|
||||
}
|
||||
|
||||
if ((p = malloc (size)) == NULL)
|
||||
p = malloc (size);
|
||||
if (p == NULL)
|
||||
{
|
||||
log_add (log_Fatal, "Fatal Error: HMalloc(): out of memory.");
|
||||
fflush (stderr);
|
||||
@@ -617,7 +85,7 @@ HCalloc (int size)
|
||||
void *
|
||||
HRealloc (void *p, int size)
|
||||
{
|
||||
// XXX: We assume throughout that HRealloc returns a valid pointer.
|
||||
// Checks similar to HMalloc are needed here.
|
||||
return realloc (p, size);
|
||||
}
|
||||
|
||||
#endif /* LEGACY_HANDLE_ALLOCATOR */
|
||||
|
||||
@@ -27,11 +27,6 @@
|
||||
#include "port.h"
|
||||
|
||||
|
||||
extern void *HMalloc (int size);
|
||||
extern void HFree (void *p);
|
||||
extern void *HCalloc (int size);
|
||||
extern void *HRealloc (void *p, int size);
|
||||
|
||||
extern int TFB_DEBUG_HALT;
|
||||
|
||||
static inline void explode (void) _NORETURN;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//#include <stdio.h>
|
||||
#include "libs/compiler.h"
|
||||
#include "port.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/uio.h"
|
||||
|
||||
typedef struct resource_index_desc RESOURCE_INDEX_DESC;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "libs/strings/strintrn.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "port.h"
|
||||
#include "libs/uio.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "options.h"
|
||||
#include "port.h"
|
||||
#include "resintrn.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/uio/charhashtable.h"
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "resintrn.h"
|
||||
#include "libs/declib.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
void *
|
||||
GetResourceData (uio_Stream *fp, DWORD length)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "resintrn.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "options.h"
|
||||
#include "types.h"
|
||||
#include "libs/log.h"
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "types.h"
|
||||
#include "libs/uio.h"
|
||||
#include "endian_uqm.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/log.h"
|
||||
#include "aiffaud.h"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "port.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/file.h"
|
||||
#include "libs/log.h"
|
||||
#include "decoder.h"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "port.h"
|
||||
#include "types.h"
|
||||
#include "libs/uio.h"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "port.h"
|
||||
#include "types.h"
|
||||
#include "endian_uqm.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "libs/misc.h"
|
||||
#include "libs/log.h"
|
||||
#include "port.h"
|
||||
#include "types.h"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "types.h"
|
||||
#include "libs/uio.h"
|
||||
#include "endian_uqm.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/log.h"
|
||||
#include "wav.h"
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "libs/misc.h"
|
||||
#include "libs/threadlib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
static uint32 mixer_initialized = 0;
|
||||
static uint32 mixer_format;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "audiodrv_nosound.h"
|
||||
#include "libs/tasklib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "audiodrv_sdl.h"
|
||||
#include "libs/tasklib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "sound.h"
|
||||
#include "libs/reslib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
static MUSIC_REF curMusicRef;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "audiodrv_openal.h"
|
||||
#include "libs/tasklib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "libs/reslib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/strings/strintrn.h"
|
||||
#include "libs/memlib.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdio.h>
|
||||
#include "libs/sndlib.h"
|
||||
#include "libs/reslib.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
extern void *_GetMusicData (uio_Stream *fp, DWORD length);
|
||||
extern BOOLEAN _ReleaseMusicData (void *handle);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "libs/compiler.h"
|
||||
#include "libs/tasklib.h"
|
||||
#include "libs/inplib.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
static Task FadeTask;
|
||||
static SIZE TTotal;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#ifndef _UQM_SOUND_H // try avoiding collisions on id
|
||||
#define _UQM_SOUND_H
|
||||
|
||||
#include "libs/misc.h"
|
||||
#include "sndintrn.h"
|
||||
#include "audiocore.h"
|
||||
#include "decoders/decoder.h"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "sound.h"
|
||||
#include "libs/tasklib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
void
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "libs/sound/trackplayer.h"
|
||||
#include "libs/sound/trackint.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "options.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/reslib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
#define MAX_STRINGS 2048
|
||||
#define POOL_SIZE 4096
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "strintrn.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
STRING_TABLE
|
||||
AllocStringTable (int num_entries, int flags)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "posixthreads.h"
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "sdlthreads.h"
|
||||
#ifdef PROFILE_THREADS
|
||||
#include <signal.h>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#include <stdlib.h>
|
||||
#include "libs/threadlib.h"
|
||||
#include "libs/timelib.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "thrcommon.h"
|
||||
|
||||
#define LIFECYCLE_SIZE 8
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "libs/uio.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "endian_uqm.h"
|
||||
|
||||
#define THIS_PTR TFB_VideoDecoder* This
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
#include "video.h"
|
||||
|
||||
#include "options.h"
|
||||
#include "vidplayer.h"
|
||||
#include "libs/inplib.h"
|
||||
#include "libs/memlib.h"
|
||||
// XXX: we should not include anything from uqm/ inside libs/
|
||||
#include "uqm/setup.h"
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#ifndef _UQM_VIDEO_H
|
||||
#define _UQM_VIDEO_H
|
||||
|
||||
#include "options.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/vidlib.h"
|
||||
#include "libs/graphics/tfb_draw.h"
|
||||
#include "types.h"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "videodec.h"
|
||||
#include "dukvid.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
#define MAX_REG_DECODERS 31
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/graphics/tfb_draw.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
// XXX: we should not include anything from uqm/ inside libs/
|
||||
#include "uqm/controls.h"
|
||||
#include "uqm/settings.h"
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <string.h>
|
||||
#include "vidintrn.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
static BOOLEAN
|
||||
FreeLegacyVideoData (void *data)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "libs/strlib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/reslib.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// For computer_intelligence()
|
||||
#include "tactrans.h"
|
||||
// For battleEndReady*
|
||||
#include "libs/misc.h"
|
||||
// For HFree()
|
||||
#include "libs/memlib.h"
|
||||
// For HMalloc(), HFree()
|
||||
#ifdef NETPLAY
|
||||
# include "netplay/netmelee.h"
|
||||
#endif /* NETPLAY */
|
||||
|
||||
+8
-14
@@ -22,7 +22,7 @@
|
||||
#include <assert.h>
|
||||
#include "port.h"
|
||||
#include "libs/compiler.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
// Note that we MUST use the QUEUE_TABLE variant at this time, because
|
||||
// certain gameplay elements depend on it. Namely, the maximum number
|
||||
@@ -32,12 +32,7 @@
|
||||
// code works now.
|
||||
#define QUEUE_TABLE
|
||||
|
||||
#ifdef QUEUE_TABLE
|
||||
typedef void* QUEUE_HANDLE;
|
||||
#else /* !QUEUE_TABLE */
|
||||
#include "libs/memlib.h"
|
||||
typedef MEM_HANDLE QUEUE_HANDLE;
|
||||
#endif /* QUEUE_TABLE */
|
||||
|
||||
typedef UWORD OBJ_SIZE;
|
||||
typedef QUEUE_HANDLE HLINK;
|
||||
@@ -66,6 +61,9 @@ typedef struct /* queue */
|
||||
|
||||
#ifdef QUEUE_TABLE
|
||||
|
||||
extern HLINK AllocLink (QUEUE *pq);
|
||||
extern void FreeLink (QUEUE *pq, HLINK hLink);
|
||||
|
||||
static inline LINK *
|
||||
LockLink (const QUEUE *pq, HLINK h)
|
||||
{
|
||||
@@ -96,10 +94,10 @@ UnlockLink (const QUEUE *pq, HLINK h)
|
||||
#define SizeQueueTab(pq) (COUNT)((pq)->num_objects)
|
||||
#define GetLinkAddr(pq,i) (HLINK)((pq)->pq_tab + ((pq)->object_size * ((i) - 1)))
|
||||
#else /* !QUEUE_TABLE */
|
||||
#define AllocLink(pq) (HLINK)mem_allocate ((pq)->object_size, DEFAULT_MEM_FLAGS)
|
||||
#define LockLink(pq, h) (LINK*)mem_lock (h)
|
||||
#define UnlockLink(pq, h) mem_unlock (h)
|
||||
#define FreeLink(pq,h) mem_release (h)
|
||||
#define AllocLink(pq) (HLINK)HMalloc ((pq)->object_size)
|
||||
#define LockLink(pq, h) ((LINK*)(h))
|
||||
#define UnlockLink(pq, h) ((void)(h))
|
||||
#define FreeLink(pq,h) HFree (h)
|
||||
#endif /* QUEUE_TABLE */
|
||||
|
||||
#define SetLinkSize(pq,s) ((pq)->object_size = (COUNT)(s))
|
||||
@@ -121,10 +119,6 @@ extern void InsertQueue (QUEUE *pq, HLINK hLink, HLINK hRefLink);
|
||||
extern void RemoveQueue (QUEUE *pq, HLINK hLink);
|
||||
extern COUNT CountLinks (QUEUE *pq);
|
||||
void ForAllLinks(QUEUE *pq, void (*callback)(LINK *, void *), void *arg);
|
||||
#ifdef QUEUE_TABLE
|
||||
extern HLINK AllocLink (QUEUE *pq);
|
||||
extern void FreeLink (QUEUE *pq, HLINK hLink);
|
||||
#endif /* QUEUE_TABLE */
|
||||
|
||||
#endif /* _DISPLIST_H */
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "libs/compiler.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "libs/log.h"
|
||||
#include "libs/mathlib.h"
|
||||
#include "libs/inplib.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
|
||||
static void DrawFadeText (const UNICODE *str1, const UNICODE *str2,
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "setup.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/threadlib.h"
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "port.h"
|
||||
#include "controls.h"
|
||||
#include "libs/inplib.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/log.h"
|
||||
#include "globdata.h"
|
||||
#include "sounds.h"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "sounds.h"
|
||||
#include "options.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
#define LOAD_TEAM_NAME_TEXT_COLOR \
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "netplay.h"
|
||||
#include "checkbuf.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
#include "../battle.h"
|
||||
// for battleFrameCount
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
// for new_ship
|
||||
#include "libs/log.h"
|
||||
#include "libs/mathlib.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
ChecksumBuffer localChecksumBuffer;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "libs/graphics/drawable.h"
|
||||
#include "libs/mathlib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "libs/strlib.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/mathlib.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
static inline long
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "libs/graphics/drawcmd.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
|
||||
//#define DEBUG_PROCESS
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "util.h"
|
||||
#include "libs/inplib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
|
||||
|
||||
// XXX: these should handle endian conversions later
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "libs/threadlib.h"
|
||||
#include "libs/vidlib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "libs/sound/sound.h"
|
||||
#include "libs/resource/stringbank.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "resinst.h"
|
||||
#include "nameref.h"
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "libs/gfxlib.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/inplib.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
#include "uqmversion.h"
|
||||
#include "options.h"
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
#include "state.h"
|
||||
|
||||
#include "encount.h"
|
||||
#include "libs/misc.h"
|
||||
#include "libs/memlib.h"
|
||||
#include "libs/log.h"
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "setup.h"
|
||||
#include "state.h"
|
||||
#include "libs/mathlib.h"
|
||||
#include "libs/misc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
Reference in New Issue
Block a user