diff options
| author | Mike Pall <mike> | 2011-03-28 15:06:30 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-03-28 15:06:30 +0200 |
| commit | 492efb7e7e9dc6951677559a99a4cc8af4c74d3f (patch) | |
| tree | 7ebcbda43c4f374a3c099d9b1a597f964da41fb8 /dynasm | |
| parent | 32aef8aee46276b654eae14692b6a20c394e41c5 (diff) | |
| download | luajit-492efb7e7e9dc6951677559a99a4cc8af4c74d3f.tar.gz luajit-492efb7e7e9dc6951677559a99a4cc8af4c74d3f.tar.bz2 luajit-492efb7e7e9dc6951677559a99a4cc8af4c74d3f.zip | |
Clean up DynASM glue macros. Thanks to Josh Haberman.
Diffstat (limited to 'dynasm')
| -rw-r--r-- | dynasm/dasm_proto.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/dynasm/dasm_proto.h b/dynasm/dasm_proto.h index 7d3f77f6..7fac22ab 100644 --- a/dynasm/dasm_proto.h +++ b/dynasm/dasm_proto.h | |||
| @@ -14,17 +14,34 @@ | |||
| 14 | #define DASM_VERSION 10202 /* 1.2.2 */ | 14 | #define DASM_VERSION 10202 /* 1.2.2 */ |
| 15 | 15 | ||
| 16 | #ifndef Dst_DECL | 16 | #ifndef Dst_DECL |
| 17 | #define Dst_DECL dasm_State *Dst | 17 | #define Dst_DECL dasm_State **Dst |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #ifndef Dst_GET | 20 | #ifndef Dst_REF |
| 21 | #define Dst_GET (Dst) | 21 | #define Dst_REF (*Dst) |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | #ifndef DASM_FDEF | 24 | #ifndef DASM_FDEF |
| 25 | #define DASM_FDEF extern | 25 | #define DASM_FDEF extern |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | #ifndef DASM_M_GROW | ||
| 29 | #define DASM_M_GROW(ctx, t, p, sz, need) \ | ||
| 30 | do { \ | ||
| 31 | size_t _sz = (sz), _need = (need); \ | ||
| 32 | if (_sz < _need) { \ | ||
| 33 | if (_sz < 16) _sz = 16; \ | ||
| 34 | while (_sz < _need) _sz += _sz; \ | ||
| 35 | (p) = (t *)realloc((p), _sz); \ | ||
| 36 | if ((p) == NULL) exit(1); \ | ||
| 37 | (sz) = _sz; \ | ||
| 38 | } \ | ||
| 39 | } while(0) | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #ifndef DASM_M_FREE | ||
| 43 | #define DASM_M_FREE(ctx, p, sz) free(p) | ||
| 44 | #endif | ||
| 28 | 45 | ||
| 29 | /* Internal DynASM encoder state. */ | 46 | /* Internal DynASM encoder state. */ |
| 30 | typedef struct dasm_State dasm_State; | 47 | typedef struct dasm_State dasm_State; |
