6 //#if !defined(_MSC_VER)
12 * Allocate space for "str", copy str into new space
13 * Return a pointer to the allocated name, or NULL if out of memory
15 char *StoreString( char *str )
17 /* To avoid wasting memory headers on small allocations, we
18 / allocate a big chunk and parcel it out as required.
19 / These static variables remember our hunk
21 #define STR_STORE_HUNK 2000
22 static char *pNextFree = NULL;
23 static int bytesLeft = 0;
28 length = strlen( str ) + 1; /* what we need, including null */
30 if (length > bytesLeft)
32 /* no space. Allocate a new hunk. We lose the pointer to any
33 / old hunk. We don't care, as the names are never deleted.
35 pNextFree = (char*)new( STR_STORE_HUNK );
36 bytesLeft = STR_STORE_HUNK;
39 /* Copy the name and terminating null into the name store */
40 pStoredString = pNextFree;
41 memcpy( pStoredString, str, length );