diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-19 21:40:37 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-19 21:40:37 -0700 |
commit | 87f252aaa53f8ce5305d84c95a8751592f647dc2 (patch) | |
tree | 9c39b2286aa34d504172bbe4c99a3d2631aeeaa8 /ndisasm.c | |
parent | eb49a4e1d402d5a1ce95e495787b900aa5303a47 (diff) | |
download | nasm-87f252aaa53f8ce5305d84c95a8751592f647dc2.tar.gz nasm-87f252aaa53f8ce5305d84c95a8751592f647dc2.tar.bz2 nasm-87f252aaa53f8ce5305d84c95a8751592f647dc2.zip |
Make nasm_malloc() et al available from inside ndisasm
Clean up nasmlib to remove functions irrelevant for ndisasm; make
nasm_malloc() etc usable inside ndisasm.
Diffstat (limited to 'ndisasm.c')
-rw-r--r-- | ndisasm.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -7,6 +7,7 @@ */ #include <stdio.h> +#include <stdarg.h> #include <stdlib.h> #include <string.h> #include <ctype.h> @@ -36,6 +37,17 @@ static const char *help = static void output_ins(uint32_t, uint8_t *, int, char *); static void skip(uint32_t dist, FILE * fp); +static void ndisasm_error(int severity, const char *fmt, ...) +{ + va_list va; + + va_start(va, fmt); + vfprintf(stderr, fmt, va); + + if (severity & ERR_FATAL) + exit(1); +} + int main(int argc, char **argv) { char buffer[INSN_MAX * 2], *p, *ep, *q; @@ -53,6 +65,8 @@ int main(int argc, char **argv) int32_t offset; FILE *fp; + nasm_set_malloc_error(ndisasm_error); + offset = 0; init_sync(); |