| 1 | |
| 2 | /******************************************** |
| 3 | memory.h |
| 4 | copyright 1991, Michael D. Brennan |
| 5 | |
| 6 | This is a source file for mawk, an implementation of |
| 7 | the AWK programming language. |
| 8 | |
| 9 | Mawk is distributed without warranty under the terms of |
| 10 | the GNU General Public License, version 2, 1991. |
| 11 | ********************************************/ |
| 12 | |
| 13 | |
| 14 | /* $Log: memory.h,v $ |
| 15 | * Revision 5.1 91/12/05 07:59:28 brennan |
| 16 | * 1.1 pre-release |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | /* memory.h */ |
| 22 | |
| 23 | #ifndef MEMORY_H |
| 24 | #define MEMORY_H |
| 25 | |
| 26 | #include "zmalloc.h" |
| 27 | |
| 28 | #define new_CELL() (CELL *) zmalloc(sizeof(CELL)) |
| 29 | #define free_CELL(p) zfree(p,sizeof(CELL)) |
| 30 | |
| 31 | #ifndef SUPPRESS_NEW_STRING_PROTO |
| 32 | STRING *PROTO( new_STRING, (char *, ...) ) ; |
| 33 | #endif |
| 34 | |
| 35 | #ifdef DEBUG |
| 36 | void PROTO( DB_free_STRING , (STRING *) ) ; |
| 37 | |
| 38 | #define free_STRING(s) DB_free_STRING(s) |
| 39 | |
| 40 | #else |
| 41 | |
| 42 | #define free_STRING(sval) if ( -- (sval)->ref_cnt == 0 )\ |
| 43 | zfree(sval, (sval)->len+STRING_OH) ; else |
| 44 | #endif |
| 45 | |
| 46 | |
| 47 | #endif /* MEMORY_H */ |