Ignore:
Timestamp:
Dec 3, 2006, 10:08:56 AM (19 years ago)
Author:
cinc
Message:

Reviewed memory allocation functions.

File:
1 edited

Legend:

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

    r94 r136  
    4646#include <nomtk.h>
    4747
     48/* This tells us if memory allocation is done using the garbage collector */
     49extern gboolean bUseGC; /* Set during initialization */
     50
    4851NOMEXTERN nomToken NOMLINK NOMMalloc(ULONG size)
    4952{
     
    6366
    6467  if((memPtr=g_malloc(size*num + sizeof(ULONG)))==NULLHANDLE)
    65     return NULLHANDLE;
    66   memset(memPtr, 0, size*num + sizeof(ULONG));
     68    return NULLHANDLE; /* We won't end here because GLib just terminates the process :-/
     69                          A really sick idea imho. */
     70  if(!bUseGC)
     71    memset(memPtr, 0, size*num + sizeof(ULONG)); /* GC always returns zeroed memory */
     72
    6773  *memPtr=size;
    6874  memPtr++;
Note: See TracChangeset for help on using the changeset viewer.