Ignore:
Timestamp:
Apr 9, 2008, 10:22:08 PM (17 years ago)
Author:
cinc
Message:

Portability patches for Windows, Linux, Darwin by Bird.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nom/src/nommemory.c

    r193 r326  
    3333* ***** END LICENSE BLOCK ***** */
    3434
    35 #define INCL_DOS
    36 #define INCL_DOSERRORS
    37 #define INCL_DOSMEMMGR
     35#ifdef __OS2__
     36# define INCL_DOS
     37# define INCL_DOSERRORS
     38# define INCL_DOSMEMMGR
     39# include <os2.h>
     40#endif /* __OS2__ */
    3841
    39 #include <os2.h>
    4042
    4143#include <string.h>
    4244#include <stdlib.h>
    4345
    44 #include <gtk/gtk.h>
     46/* #include <gtk/gtk.h> - why? */
    4547#include <nom.h>
    4648#include <nomtk.h>
     
    4951extern gboolean bUseGC; /* Set during initialization */
    5052
    51 NOMEXTERN nomToken NOMLINK NOMMalloc(ULONG size)
     53NOMEXTERN nomToken NOMLINK NOMMalloc(const gulong size)
    5254{
    5355  gchar* memPtr;
    5456
    55   if((memPtr=g_malloc(size))==NULLHANDLE)
    56     return NULLHANDLE;
     57  if((memPtr=g_malloc(size))==NULL)
     58    return NULL;
    5759
    5860  return (nomToken) memPtr;
     
    6163  PULONG memPtr;
    6264
    63   if((memPtr=g_malloc(size+sizeof(gpointer)))==NULLHANDLE)
    64     return NULLHANDLE;
     65  if((memPtr=g_malloc(size+sizeof(gpointer)))==NULL)
     66    return NULL;
    6567
    6668  *memPtr=size;
     
    7072}
    7173
    72 nomToken NOMLINK NOMCalloc(const ULONG num, const ULONG size)
     74nomToken NOMLINK NOMCalloc(const gulong num, const gulong size)
    7375{
    7476  gchar* memPtr;
    7577
    76   if((memPtr=g_malloc(size*num ))==NULLHANDLE)
    77     return NULLHANDLE; /* We won't end here because GLib just terminates the process :-/
     78  if((memPtr=g_malloc(size*num ))==NULL)
     79    return NULL; /* We won't end here because GLib just terminates the process :-/
    7880                          A really sick idea imho. */
    7981  if(!bUseGC)
     
    8587  PULONG memPtr;
    8688
    87   if((memPtr=g_malloc(size*num + sizeof(ULONG)))==NULLHANDLE)
    88     return NULLHANDLE; /* We won't end here because GLib just terminates the process :-/
     89  if((memPtr=g_malloc(size*num + sizeof(gulong)))==NULL)
     90    return NULL; /* We won't end here because GLib just terminates the process :-/
    8991                          A really sick idea imho. */
    9092  if(!bUseGC)
    91     memset(memPtr, 0, size*num + sizeof(ULONG)); /* GC always returns zeroed memory */
     93    memset(memPtr, 0, size*num + sizeof(gulong)); /* GC always returns zeroed memory */
    9294
    9395  *memPtr=size;
     
    103105{
    104106#if 0
    105   ULONG* pul=(PULONG)memPtr;
     107  gulong* pul=(PULONG)memPtr;
    106108
    107109  pul--;
Note: See TracChangeset for help on using the changeset viewer.