/usr/include/spooles/Utilities/MM.h is in libspooles-dev 2.2-10build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /* memory.h */
/*====================================================================*/
/*
-------------------------------------------------------
flag to turn on the memory functions debugging commands
-------------------------------------------------------
*/
#define MEMORY_DEBUG 0
/*
----------------------------------------------------------
my memory allocation function
ptr -- variable to be given the address of the memory
type -- type of data, can be a struct
count -- number of data elements
proc -- procedure name for error message
e.g.,
int *indices ;
double *entries ;
struct elem *elems
ALLOCATE(indices, int, nindices) ;
ALLOCATE(entries, int, nrow*ncol) ;
ALLOCATE(elems, struct elem, nelem) ;
created -- 95sep22, cca
----------------------------------------------------------
*/
#define ALLOCATE(ptr, type, count) \
if ( (count) > 0 ) { \
if ( (ptr = (type *)malloc((unsigned long)((count)*sizeof(type)))) \
== NULL ) {\
fprintf(stderr, \
"\n ALLOCATE failure : bytes %d, line %d, file %s", \
(count)*sizeof(type), __LINE__, __FILE__) ; \
exit(-1) ; } \
else if ( MEMORY_DEBUG > 0 ) { \
fprintf(stderr, \
"\n ALLOCATE : address %p, bytes %d, line %d, file %s", \
ptr, (count)*sizeof(type), __LINE__, __FILE__) ; } } \
else if ( (count) == 0 ) { \
ptr = NULL ; } \
else { \
fprintf(stderr, \
"\n ALLOCATE error : bytes %d, line %d, file %s", \
(count)*sizeof(type), __LINE__, __FILE__) ; \
exit(-1) ; }
/*
--------------------------------------------------------
my function to free memory, all it does is check to see
if the pointer is NULL, calls system routine if not NULL
--------------------------------------------------------
*/
#if MEMORY_DEBUG > 0
#define FREE(ptr) \
if ( (ptr) != NULL ) { \
fprintf(stderr, "\n FREE, line %d, file %s : address %p", \
__LINE__, __FILE__, ptr) ; \
free((char *) (ptr)) ; \
(ptr) = NULL ; }
#else
#define FREE(ptr) \
if ( (ptr) != NULL ) { \
free((char *) (ptr)) ; \
(ptr) = NULL ; }
#endif
/*====================================================================*/
|