From e5eb6ade2cfbc3493d4462b4aa8c92bd26f7a0c8 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 21 Mar 2016 18:52:20 +0000 Subject: Tweak NULL output code. In the quest for better mutool draw timings, make fz_outputs going to /dev/null be represented by a NULL pointer. Spot this in the output routines and just exit. --- source/fitz/output.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'source/fitz/output.c') diff --git a/source/fitz/output.c b/source/fitz/output.c index 1904ee85..9ea2d169 100644 --- a/source/fitz/output.c +++ b/source/fitz/output.c @@ -62,35 +62,6 @@ fz_new_output_with_file_ptr(fz_context *ctx, FILE *file, int close) return out; } -static void -null_write(fz_context *ctx, void *opaque, const void *buffer, int count) -{ - return; -} - -static void -null_seek(fz_context *ctx, void *opaque, fz_off_t off, int whence) -{ -} - -static fz_off_t -null_tell(fz_context *ctx, void *opaque) -{ - return 0; -} - -static fz_output * -null_filename(fz_context *ctx) -{ - fz_output *out = fz_malloc_struct(ctx, fz_output); - out->opaque = NULL; - out->write = null_write; - out->seek = null_seek; - out->tell = null_tell; - out->close = NULL; - return out; -} - fz_output * fz_new_output_with_path(fz_context *ctx, const char *filename, int append) { @@ -98,7 +69,7 @@ fz_new_output_with_path(fz_context *ctx, const char *filename, int append) FILE *file; if (!strcmp(filename, "/dev/null") || !fz_strcasecmp(filename, "nul:")) - return null_filename(ctx); + return NULL; file = fz_fopen(filename, append ? "ab" : "wb"); if (!file) -- cgit v1.2.3