X-Git-Url: https://deadsoftware.ru/gitweb?p=flatwaifu.git;a=blobdiff_plain;f=src%2Fmemory.c;h=7089cc5cadb64d31aec69a2ecd8dccc6b518821d;hp=d3c5e8ccf8364e55b875f59fa472ab986d460fb4;hb=2b481ae25adcf3bebf37be182eafc8bfa0acb4c1;hpb=2a4083d2b1d0efed86339e7f73b7142c255574a8 diff --git a/src/memory.c b/src/memory.c index d3c5e8c..7089cc5 100644 --- a/src/memory.c +++ b/src/memory.c @@ -27,18 +27,11 @@ #include "files.h" #include "memory.h" -dword dpmi_memavl(void); - -extern int d_start,d_end; - -extern mwad_t wad[]; - -static byte m_active=FALSE; - +static byte m_active; static void *resp[MAX_WAD]; static short resl[MAX_WAD]; -void M_startup(void) { +void M_startup (void) { if(m_active) return; logo("M_startup: настройка памяти\n"); memset(resp,0,sizeof(resp)); @@ -47,13 +40,12 @@ void M_startup(void) { m_active=TRUE; } -void M_shutdown(void) { - +void M_shutdown (void) { if(!m_active) return; m_active=FALSE; } -static void allocres(int h) { +static void allocres (int h) { int *p,s; if(h>d_start && h=MAX_WAD) ERR_fatal("M_lock: странный номер ресурса"); if(!resl[h]) if(!resp[h]) allocres(h); ++resl[h]; return resp[h]; } -void M_unlock(void *p) { +void M_unlock (void *p) { int h; if(!p) return; @@ -92,9 +83,9 @@ void M_unlock(void *p) { } int M_locked (int h) { - return (h != -1) && (h != 0xFFFF) && (resl[h & (-1 - 0x8000)] != 0); + return (h != -1) && (h != 0xFFFF) && (resl[h] != 0); } int M_was_locked (int h) { - return (h != -1) && (h != 0xFFFF) && (resp[h & (-1 - 0x8000)] != NULL); + return (h != -1) && (h != 0xFFFF) && (resp[h] != NULL); }