summaryrefslogtreecommitdiff
path: root/ndisasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-18 21:07:17 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-07-18 18:43:12 -0700
commit9bd1506d5999d7c41a4cf6de2f43b97939bb260e (patch)
treed3dad5bda2b167af7dfe29cad7cb532406ddb1c4 /ndisasm.c
parent159178f2aa516718fcb420a281c17adc8b330492 (diff)
downloadnasm-9bd1506d5999d7c41a4cf6de2f43b97939bb260e.tar.gz
Remove function pointers in output, simplify error handling
Remove a bunch of function pointers in the output stage; they are never changed and don't add any value. Also make "ofile" a global variable and let the backend use it directly. All we ever did with these variables were stashing it in locals and using them as-is anyway for no benefit. Also change the global error function, nasm_error() into a true function which invokes a function pointer internally. That lets us use direct calls to it. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'ndisasm.c')
-rw-r--r--ndisasm.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/ndisasm.c b/ndisasm.c
index 9234c6ee..8c924b9c 100644
--- a/ndisasm.c
+++ b/ndisasm.c
@@ -68,11 +68,8 @@ 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, ...)
+static void ndisasm_verror(int severity, const char *fmt, va_list va)
{
- va_list va;
-
- va_start(va, fmt);
vfprintf(stderr, fmt, va);
if (severity & ERR_FATAL)
@@ -97,7 +94,8 @@ int main(int argc, char **argv)
FILE *fp;
tolower_init();
- nasm_set_malloc_error(ndisasm_error);
+ nasm_set_verror(ndisasm_verror);
+ nasm_init_malloc_error();
offset = 0;
init_sync();