Changeset 326 for trunk/nom/src/nommemory.c
- Timestamp:
- Apr 9, 2008, 10:22:08 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nom/src/nommemory.c
r193 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 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__ */ 38 41 39 #include <os2.h>40 42 41 43 #include <string.h> 42 44 #include <stdlib.h> 43 45 44 #include <gtk/gtk.h> 46 /* #include <gtk/gtk.h> - why? */ 45 47 #include <nom.h> 46 48 #include <nomtk.h> … … 49 51 extern gboolean bUseGC; /* Set during initialization */ 50 52 51 NOMEXTERN nomToken NOMLINK NOMMalloc( ULONGsize)53 NOMEXTERN nomToken NOMLINK NOMMalloc(const gulong size) 52 54 { 53 55 gchar* memPtr; 54 56 55 if((memPtr=g_malloc(size))==NULL HANDLE)56 return NULL HANDLE;57 if((memPtr=g_malloc(size))==NULL) 58 return NULL; 57 59 58 60 return (nomToken) memPtr; … … 61 63 PULONG memPtr; 62 64 63 if((memPtr=g_malloc(size+sizeof(gpointer)))==NULL HANDLE)64 return NULL HANDLE;65 if((memPtr=g_malloc(size+sizeof(gpointer)))==NULL) 66 return NULL; 65 67 66 68 *memPtr=size; … … 70 72 } 71 73 72 nomToken NOMLINK NOMCalloc(const ULONG num, const ULONGsize)74 nomToken NOMLINK NOMCalloc(const gulong num, const gulong size) 73 75 { 74 76 gchar* memPtr; 75 77 76 if((memPtr=g_malloc(size*num ))==NULL HANDLE)77 return NULL HANDLE; /* 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 :-/ 78 80 A really sick idea imho. */ 79 81 if(!bUseGC) … … 85 87 PULONG memPtr; 86 88 87 if((memPtr=g_malloc(size*num + sizeof( ULONG)))==NULLHANDLE)88 return NULL HANDLE; /* 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 :-/ 89 91 A really sick idea imho. */ 90 92 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 */ 92 94 93 95 *memPtr=size; … … 103 105 { 104 106 #if 0 105 ULONG* pul=(PULONG)memPtr;107 gulong* pul=(PULONG)memPtr; 106 108 107 109 pul--;
Note:
See TracChangeset
for help on using the changeset viewer.