Lines Matching defs:nbytes
41 static void *_crAlloc( unsigned int nbytes )
43 DECLEXPORT(void) *crAlloc( unsigned int nbytes )
46 void *ret = malloc( nbytes );
48 crError( "Out of memory trying to allocate %d bytes!", nbytes );
54 void *crAllocDebug( unsigned int nbytes, const char *file, int line )
57 if (nbytes >= THRESHOLD)
58 fprintf(stderr, "crAllocDebug(%d bytes) in %s at %d\n", nbytes, file, line);
59 return _crAlloc(nbytes);
61 return crAlloc(nbytes);
66 static void *_crCalloc( unsigned int nbytes )
68 DECLEXPORT(void) *crCalloc( unsigned int nbytes )
71 void *ret = malloc( nbytes );
73 crError( "Out of memory trying to (c)allocate %d bytes!", nbytes );
76 crMemset( ret, 0, nbytes );
80 void *crCallocDebug( unsigned int nbytes, const char *file, int line )
83 if (nbytes >= THRESHOLD)
84 fprintf(stderr, "crCallocDebug(%d bytes) in %s at %d\n", nbytes, file, line);
85 return _crCalloc(nbytes);
87 return crCalloc(nbytes);
91 DECLEXPORT(void) crRealloc( void **ptr, unsigned int nbytes )
96 *ptr = _crAlloc( nbytes );
98 *ptr = crAlloc( nbytes );
103 *ptr = realloc( *ptr, nbytes );
105 crError( "Couldn't realloc %d bytes!", nbytes );