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/dasm_proto.h | |
parent | 32aef8aee46276b654eae14692b6a20c394e41c5 (diff) | |
download | luajit2-492efb7e7e9dc6951677559a99a4cc8af4c74d3f.tar.gz |
Clean up DynASM glue macros. Thanks to Josh Haberman.
Diffstat (limited to 'dynasm/dasm_proto.h')
-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 @@ #define DASM_VERSION 10202 /* 1.2.2 */ #ifndef Dst_DECL -#define Dst_DECL dasm_State *Dst +#define Dst_DECL dasm_State **Dst #endif -#ifndef Dst_GET -#define Dst_GET (Dst) +#ifndef Dst_REF +#define Dst_REF (*Dst) #endif #ifndef DASM_FDEF #define DASM_FDEF extern #endif +#ifndef DASM_M_GROW +#define DASM_M_GROW(ctx, t, p, sz, need) \ + do { \ + size_t _sz = (sz), _need = (need); \ + if (_sz < _need) { \ + if (_sz < 16) _sz = 16; \ + while (_sz < _need) _sz += _sz; \ + (p) = (t *)realloc((p), _sz); \ + if ((p) == NULL) exit(1); \ + (sz) = _sz; \ + } \ + } while(0) +#endif + +#ifndef DASM_M_FREE +#define DASM_M_FREE(ctx, p, sz) free(p) +#endif /* Internal DynASM encoder state. */ typedef struct dasm_State dasm_State; |