diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-11-01 03:25:13 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-11-01 03:25:13 +0100 |
commit | 691028a1c0528158e8a8ec04631b26b46caa3804 (patch) | |
tree | a9fd4eabd25976fbce711e12da9496b41cdd5f06 | |
parent | 082f865c4e16e525076a86df5da2a1b03da293bb (diff) | |
download | mupdf-691028a1c0528158e8a8ec04631b26b46caa3804.tar.xz |
great free -> drop renaming
79 files changed, 247 insertions, 245 deletions
diff --git a/base/error.c b/base/error.c index b00157e3..df795192 100644 --- a/base/error.c +++ b/base/error.c @@ -57,7 +57,7 @@ fz_throw0(const char *func, const char *file, int line, char *fmt, ...) } void -fz_freeerror(fz_error *eo) +fz_droperror(fz_error *eo) { if (!eo->frozen) fz_free(eo); diff --git a/base/hash.c b/base/hash.c index 962b92e1..c6d811c2 100644 --- a/base/hash.c +++ b/base/hash.c @@ -92,7 +92,7 @@ fz_hashgetval(fz_hashtable *table, int idx) } void -fz_freehash(fz_hashtable *table) +fz_drophash(fz_hashtable *table) { fz_free(table->ents); fz_free(table); diff --git a/filter/a85d.c b/filter/a85d.c index 08c96a1b..5b2e105e 100644 --- a/filter/a85d.c +++ b/filter/a85d.c @@ -29,9 +29,8 @@ fz_newa85d(fz_filter **fp, fz_obj *params) } void -fz_freea85d(fz_filter *f) +fz_dropa85d(fz_filter *f) { - fz_free(f); } fz_error * diff --git a/filter/a85e.c b/filter/a85e.c index c57aac4f..d9cd22c6 100644 --- a/filter/a85e.c +++ b/filter/a85e.c @@ -17,9 +17,8 @@ fz_newa85e(fz_filter **fp, fz_obj *params) } void -fz_freea85e(fz_filter *f) +fz_dropa85e(fz_filter *f) { - fz_free(f); } fz_error * diff --git a/filter/ahxd.c b/filter/ahxd.c index b557399c..d0e6d7f5 100644 --- a/filter/ahxd.c +++ b/filter/ahxd.c @@ -47,9 +47,8 @@ fz_newahxd(fz_filter **fp, fz_obj *params) } void -fz_freeahxd(fz_filter *f) +fz_dropahxd(fz_filter *f) { - fz_free(f); } fz_error * diff --git a/filter/ahxe.c b/filter/ahxe.c index e092653b..c2b882a6 100644 --- a/filter/ahxe.c +++ b/filter/ahxe.c @@ -19,9 +19,8 @@ fz_newahxe(fz_filter **fp, fz_obj *params) } void -fz_freeahxe(fz_filter *f) +fz_dropahxe(fz_filter *f) { - fz_free(f); } fz_error * diff --git a/filter/arc4filter.c b/filter/arc4filter.c index 257462d8..b025368c 100644 --- a/filter/arc4filter.c +++ b/filter/arc4filter.c @@ -17,9 +17,8 @@ fz_newarc4filter(fz_filter **fp, unsigned char *key, unsigned keylen) } void -fz_freearc4filter(fz_filter *f) +fz_droparc4filter(fz_filter *f) { - fz_free(f); } fz_error * diff --git a/filter/buffer.c b/filter/buffer.c index def667ea..1b7a0793 100644 --- a/filter/buffer.c +++ b/filter/buffer.c @@ -40,7 +40,7 @@ fz_newbufferwithdata(fz_buffer **bp, unsigned char *data, int size) } void -fz_freebuffer(fz_buffer *buf) +fz_dropbuffer(fz_buffer *buf) { if (buf->ownsdata) fz_free(buf->bp); diff --git a/filter/dctd.c b/filter/dctd.c index dd978ac7..0c0b072e 100644 --- a/filter/dctd.c +++ b/filter/dctd.c @@ -95,7 +95,7 @@ fz_newdctd(fz_filter **fp, fz_obj *params) } void -fz_freedctd(fz_filter *filter) +fz_dropdctd(fz_filter *filter) { fz_dctd *d = (fz_dctd*)filter; if (setjmp(d->err.jb)) { diff --git a/filter/dcte.c b/filter/dcte.c index 52933789..547721b4 100644 --- a/filter/dcte.c +++ b/filter/dcte.c @@ -122,7 +122,7 @@ fz_newdcte(fz_filter **fp, fz_obj *params) } void -fz_freedcte(fz_filter *filter) +fz_dropdcte(fz_filter *filter) { fz_dcte *e = (fz_dcte*)filter; @@ -132,8 +132,6 @@ fz_freedcte(fz_filter *filter) } jpeg_destroy_compress(&e->cinfo); - - fz_free(e); } /* Adobe says zigzag order. IJG > v6a says natural order. */ diff --git a/filter/faxd.c b/filter/faxd.c index 1b86c17b..81e04b81 100644 --- a/filter/faxd.c +++ b/filter/faxd.c @@ -114,12 +114,11 @@ fz_newfaxd(fz_filter **fp, fz_obj *params) } void -fz_freefaxd(fz_filter *p) +fz_dropfaxd(fz_filter *p) { fz_faxd *fax = (fz_faxd*) p; fz_free(fax->ref); fz_free(fax->dst); - fz_free(fax); } static inline void eatbits(fz_faxd *fax, int nbits) diff --git a/filter/faxe.c b/filter/faxe.c index 20e776dd..ccede1a1 100644 --- a/filter/faxe.c +++ b/filter/faxe.c @@ -95,12 +95,11 @@ fz_newfaxe(fz_filter **fp, fz_obj *params) } void -fz_freefaxe(fz_filter *p) +fz_dropfaxe(fz_filter *p) { fz_faxe *fax = (fz_faxe*) p; fz_free(fax->src); fz_free(fax->ref); - fz_free(fax); } enum { codebytes = 2 }; diff --git a/filter/filec.c b/filter/filec.c index f03be8a4..4c132b33 100644 --- a/filter/filec.c +++ b/filter/filec.c @@ -126,26 +126,26 @@ fz_closefile(fz_file *file) if (file->error) { fz_warn("%s", file->error->msg); - fz_freeerror(file->error); + fz_droperror(file->error); file->error = nil; } if (file->fd == -1) /* open to buffer not file */ { if (file->mode == FZ_READ) - fz_freebuffer(file->in); + fz_dropbuffer(file->in); else - fz_freebuffer(file->out); + fz_dropbuffer(file->out); } else { - fz_freebuffer(file->in); - fz_freebuffer(file->out); + fz_dropbuffer(file->in); + fz_dropbuffer(file->out); close(file->fd); } if (file->filter) - fz_freefilter(file->filter); + fz_dropfilter(file->filter); fz_free(file); } @@ -230,13 +230,13 @@ fz_popfilter(fz_file *file) if (file->error) { fz_warn("%s", file->error->msg); - fz_freeerror(file->error); + fz_droperror(file->error); file->error = nil; } if (file->depth == 1) { - fz_freefilter(file->filter); + fz_dropfilter(file->filter); file->filter = nil; buf = file->out; @@ -247,12 +247,12 @@ fz_popfilter(fz_file *file) { if (file->mode == FZ_READ) { - fz_freebuffer(file->out); + fz_dropbuffer(file->out); fz_unchainpipeline(file->filter, &file->filter, &file->out); } else { - fz_freebuffer(file->in); + fz_dropbuffer(file->in); fz_unchainpipeline(file->filter, &file->filter, &file->in); } } diff --git a/filter/filter.c b/filter/filter.c index 68dd70b9..25bbd441 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -32,8 +32,10 @@ fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out) } void -fz_freefilter(fz_filter *f) +fz_dropfilter(fz_filter *f) { - f->free(f); + if (f->drop) + f->drop(f); + fz_free(f); } diff --git a/filter/flate.c b/filter/flate.c index f7046474..c34a49b7 100644 --- a/filter/flate.c +++ b/filter/flate.c @@ -42,7 +42,7 @@ fz_newflated(fz_filter **fp, fz_obj *params) } void -fz_freeflated(fz_filter *f) +fz_dropflated(fz_filter *f) { z_streamp zp = &((fz_flate*)f)->z; int err; @@ -50,8 +50,6 @@ fz_freeflated(fz_filter *f) err = inflateEnd(zp); if (err != Z_OK) fprintf(stderr, "inflateEnd: %s", zp->msg); - - fz_free(f); } fz_error * @@ -126,7 +124,7 @@ fz_newflatee(fz_filter **fp, fz_obj *params) } void -fz_freeflatee(fz_filter *f) +fz_dropflatee(fz_filter *f) { z_streamp zp = &((fz_flate*)f)->z; int err; diff --git a/filter/jbig2d.c b/filter/jbig2d.c index 3d191e65..5d762d2f 100644 --- a/filter/jbig2d.c +++ b/filter/jbig2d.c @@ -51,11 +51,10 @@ fz_newjbig2d(fz_filter **fp, fz_obj *params) } void -fz_freejbig2d(fz_filter *filter) +fz_dropjbig2d(fz_filter *filter) { fz_jbig2d *d = (fz_jbig2d*)filter; jbig2_ctx_free(d->ctx); - fz_free(d); } fz_error * diff --git a/filter/jpxd.c b/filter/jpxd.c index 26ec743b..2aa93448 100644 --- a/filter/jpxd.c +++ b/filter/jpxd.c @@ -60,12 +60,11 @@ fz_newjpxd(fz_filter **fp, fz_obj *params) } void -fz_freejpxd(fz_filter *filter) +fz_dropjpxd(fz_filter *filter) { fz_jpxd *d = (fz_jpxd*)filter; if (d->stream) jas_stream_close(d->stream); if (d->image) jas_image_destroy(d->image); - fz_free(d); } fz_error * diff --git a/filter/lzwd.c b/filter/lzwd.c index 1ab47357..b3a0dcfa 100644 --- a/filter/lzwd.c +++ b/filter/lzwd.c @@ -91,9 +91,8 @@ fz_newlzwd(fz_filter **fp, fz_obj *params) } void -fz_freelzwd(fz_filter *filter) +fz_droplzwd(fz_filter *filter) { - fz_free(filter); } static inline void eatbits(fz_lzwd *lzw, int nbits) diff --git a/filter/lzwe.c b/filter/lzwe.c index dbb6967b..8065a7b6 100644 --- a/filter/lzwe.c +++ b/filter/lzwe.c @@ -91,9 +91,8 @@ fz_newlzwe(fz_filter **fp, fz_obj *params) } void -fz_freelzwe(fz_filter *filter) +fz_droplzwe(fz_filter *filter) { - fz_free(filter); } static void diff --git a/filter/null.c b/filter/null.c index a4af03b1..e83b6d5a 100644 --- a/filter/null.c +++ b/filter/null.c @@ -19,9 +19,8 @@ fz_newnullfilter(fz_filter **fp, int len) } void -fz_freenullfilter(fz_filter *f) +fz_dropnullfilter(fz_filter *f) { - fz_free(f); } fz_error * diff --git a/filter/pipeline.c b/filter/pipeline.c index ef0412c0..4ac0da58 100644 --- a/filter/pipeline.c +++ b/filter/pipeline.c @@ -32,7 +32,7 @@ fz_unchainpipeline(fz_filter *filter, fz_filter **oldfp, fz_buffer **oldbp) fz_pipeline *p = (fz_pipeline*)filter; *oldfp = p->head; *oldbp = p->buffer; - fz_freefilter(p->tail); + fz_dropfilter(p->tail); fz_free(p); } @@ -53,13 +53,12 @@ fz_newpipeline(fz_filter **fp, fz_filter *head, fz_filter *tail) } void -fz_freepipeline(fz_filter *filter) +fz_droppipeline(fz_filter *filter) { fz_pipeline *p = (fz_pipeline*)filter; - fz_freefilter(p->head); - fz_freefilter(p->tail); - fz_freebuffer(p->buffer); - fz_free(p); + fz_dropfilter(p->head); + fz_dropfilter(p->tail); + fz_dropbuffer(p->buffer); } fz_error * diff --git a/filter/predict.c b/filter/predict.c index d5f1f54d..d7b594ac 100644 --- a/filter/predict.c +++ b/filter/predict.c @@ -64,11 +64,10 @@ fz_newpredict(fz_filter **fp, fz_obj *params, int encode) } void -fz_freepredict(fz_filter *filter) +fz_droppredict(fz_filter *filter) { fz_predict *p = (fz_predict*)filter; fz_free(p->ref); - fz_free(p); } static inline int diff --git a/filter/rld.c b/filter/rld.c index a66e0f94..bcad4323 100644 --- a/filter/rld.c +++ b/filter/rld.c @@ -8,9 +8,8 @@ fz_newrld(fz_filter **fp, fz_obj *params) } void -fz_freerld(fz_filter *rld) +fz_droprld(fz_filter *rld) { - fz_free(rld); } fz_error * diff --git a/filter/rle.c b/filter/rle.c index 0e611918..53197139 100644 --- a/filter/rle.c +++ b/filter/rle.c @@ -45,9 +45,8 @@ fz_newrle(fz_filter **fp, fz_obj *params) } void -fz_freerle(fz_filter *enc) +fz_droprle(fz_filter *enc) { - fz_free(enc); } static fz_error * diff --git a/include/fitz/base.h b/include/fitz/base.h index 06a644b3..9ead6c88 100644 --- a/include/fitz/base.h +++ b/include/fitz/base.h @@ -44,7 +44,7 @@ fz_error *fz_throw0(const char *func, const char *file, int line, char *fmt, ... void fz_warn(char *fmt, ...); void fz_abort(fz_error *eo); -void fz_freeerror(fz_error *eo); +void fz_droperror(fz_error *eo); typedef struct fz_memorycontext_s fz_memorycontext; diff --git a/include/fitz/cmap.h b/include/fitz/cmap.h index ddd37149..b076d749 100644 --- a/include/fitz/cmap.h +++ b/include/fitz/cmap.h @@ -2,7 +2,7 @@ typedef struct fz_cmap_s fz_cmap; fz_error *fz_newcmap(fz_cmap **cmapp); void fz_debugcmap(fz_cmap *cmap); -void fz_freecmap(fz_cmap *cmap); +void fz_dropcmap(fz_cmap *cmap); char *fz_getcmapname(fz_cmap *cmap); void fz_setcmapname(fz_cmap *cmap, char *name); diff --git a/include/fitz/colorspace.h b/include/fitz/colorspace.h index 370c755f..9b5a5dbb 100644 --- a/include/fitz/colorspace.h +++ b/include/fitz/colorspace.h @@ -1,4 +1,8 @@ typedef struct fz_colorspace_s fz_colorspace; +typedef struct fz_colorcube_s fz_colorcube; +typedef struct fz_colorcube1_s fz_colorcube1; +typedef struct fz_colorcube3_s fz_colorcube3; +typedef struct fz_colorcube4_s fz_colorcube4; struct fz_colorspace_s { @@ -7,9 +11,20 @@ struct fz_colorspace_s int n; void (*toxyz)(fz_colorspace *, float *src, float *xyz); void (*fromxyz)(fz_colorspace *, float *xyz, float *dst); - void (*free)(fz_colorspace *); + void (*drop)(fz_colorspace *); }; -void fz_freecolorspace(fz_colorspace *cs); +struct fz_colorcube1_s { unsigned char v[17]; }; +struct fz_colorcube3_s { unsigned char v[17][17][17]; }; +struct fz_colorcube4_s { unsigned char v[17][17][17][17]; }; + +struct fz_colorcube_s +{ + fz_colorspace *src; + fz_colorspace *dst; + void **subcube; /* dst->n * colorcube(src->n) */ +}; + +void fz_dropcolorspace(fz_colorspace *cs); void fz_convertcolor(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *dstv); diff --git a/include/fitz/filter.h b/include/fitz/filter.h index f6a1603f..225cb172 100644 --- a/include/fitz/filter.h +++ b/include/fitz/filter.h @@ -13,12 +13,12 @@ extern fz_error fz_kiodone; #define FZ_NEWFILTER(TYPE,VAR,NAME) \ fz_error * fz_process ## NAME (fz_filter*,fz_buffer*,fz_buffer*); \ - void fz_free ## NAME (fz_filter*); \ + void fz_drop ## NAME (fz_filter*); \ TYPE *VAR; \ *fp = fz_malloc(sizeof(TYPE)); \ if (!*fp) return fz_outofmem; \ (*fp)->process = fz_process ## NAME ; \ - (*fp)->free = fz_free ## NAME ; \ + (*fp)->drop = fz_drop ## NAME ; \ (*fp)->consumed = 0; \ (*fp)->produced = 0; \ (*fp)->count = 0; \ @@ -27,7 +27,7 @@ extern fz_error fz_kiodone; struct fz_filter_s { fz_error* (*process)(fz_filter *filter, fz_buffer *in, fz_buffer *out); - void (*free)(fz_filter *filter); + void (*drop)(fz_filter *filter); int consumed; int produced; int count; @@ -44,7 +44,7 @@ struct fz_buffer_s }; fz_error *fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out); -void fz_freefilter(fz_filter *f); +void fz_dropfilter(fz_filter *f); fz_error *fz_newnullfilter(fz_filter **fp, int len); fz_error *fz_newarc4filter(fz_filter **fp, unsigned char *key, unsigned keylen); @@ -57,7 +57,7 @@ fz_error *fz_newbuffer(fz_buffer **bufp, int size); fz_error *fz_newbufferwithdata(fz_buffer **bufp, unsigned char *data, int size); fz_error *fz_rewindbuffer(fz_buffer *buf); fz_error *fz_growbuffer(fz_buffer *buf); -void fz_freebuffer(fz_buffer *buf); +void fz_dropbuffer(fz_buffer *buf); fz_error *fz_newa85d(fz_filter **filterp, fz_obj *param); fz_error *fz_newa85e(fz_filter **filterp, fz_obj *param); diff --git a/include/fitz/font.h b/include/fitz/font.h index d64c1fc3..4d9fb5e8 100644 --- a/include/fitz/font.h +++ b/include/fitz/font.h @@ -25,7 +25,7 @@ struct fz_font_s char name[32]; fz_error* (*render)(fz_glyph*, fz_font*, int, fz_matrix); - void (*free)(fz_font *); + void (*drop)(fz_font *); int wmode; fz_irect bbox; @@ -46,7 +46,7 @@ struct fz_glyph_s }; void fz_initfont(fz_font *font, char *name); -void fz_freefont(fz_font *font); +void fz_dropfont(fz_font *font); void fz_debugfont(fz_font *font); void fz_setfontwmode(fz_font *font, int wmode); void fz_setfontbbox(fz_font *font, int xmin, int ymin, int xmax, int ymax); @@ -61,5 +61,5 @@ fz_vmtx fz_getvmtx(fz_font *font, int cid); fz_error *fz_newglyphcache(fz_glyphcache **arenap, int slots, int size); fz_error *fz_renderglyph(fz_glyphcache*, fz_glyph*, fz_font*, int, fz_matrix); -void fz_freeglyphcache(fz_glyphcache *); +void fz_dropglyphcache(fz_glyphcache *); diff --git a/include/fitz/hash.h b/include/fitz/hash.h index 731e5fab..c53056bc 100644 --- a/include/fitz/hash.h +++ b/include/fitz/hash.h @@ -3,7 +3,7 @@ typedef struct fz_hashtable_s fz_hashtable; fz_error *fz_newhash(fz_hashtable **tablep, int initialsize, int keylen); fz_error *fz_resizehash(fz_hashtable *table, int newsize); void fz_debughash(fz_hashtable *table); -void fz_freehash(fz_hashtable *table); +void fz_drophash(fz_hashtable *table); void *fz_hashfind(fz_hashtable *table, void *key); fz_error *fz_hashinsert(fz_hashtable *table, void *key, void *val); diff --git a/include/fitz/image.h b/include/fitz/image.h index ea3ebaa9..13d4d096 100644 --- a/include/fitz/image.h +++ b/include/fitz/image.h @@ -5,7 +5,7 @@ typedef struct fz_image_s fz_image; struct fz_image_s { fz_error* (*loadtile)(fz_image*,fz_pixmap*); - void (*free)(fz_image*); + void (*drop)(fz_image*); fz_colorspace *cs; int w, h, n, a; }; diff --git a/include/fitz/object.h b/include/fitz/object.h index c564b70b..520fa27f 100644 --- a/include/fitz/object.h +++ b/include/fitz/object.h @@ -100,7 +100,6 @@ int fz_arraylen(fz_obj *array); fz_obj *fz_arrayget(fz_obj *array, int i); fz_error *fz_arrayput(fz_obj *array, int i, fz_obj *obj); fz_error *fz_arraypush(fz_obj *array, fz_obj *obj); -void fz_freearray(fz_obj *array); int fz_dictlen(fz_obj *dict); fz_obj *fz_dictgetkey(fz_obj *dict, int idx); @@ -111,7 +110,6 @@ fz_error *fz_dictput(fz_obj *dict, fz_obj *key, fz_obj *val); fz_error *fz_dictputs(fz_obj *dict, char *key, fz_obj *val); fz_error *fz_dictdel(fz_obj *dict, fz_obj *key); fz_error *fz_dictdels(fz_obj *dict, char *key); -void fz_freedict(fz_obj *dict); int fz_sprintobj(char *s, int n, fz_obj *obj, int tight); void fz_debugobj(fz_obj *obj); diff --git a/include/fitz/path.h b/include/fitz/path.h index 1c8a05a8..f128d86e 100644 --- a/include/fitz/path.h +++ b/include/fitz/path.h @@ -55,5 +55,5 @@ fz_rect fz_boundpathnode(fz_pathnode *node, fz_matrix ctm); void fz_debugpathnode(fz_pathnode *node); fz_error *fz_newdash(fz_dash **dashp, float phase, int len, float *array); -void fz_freedash(fz_dash *dash); +void fz_dropdash(fz_dash *dash); diff --git a/include/fitz/pixmap.h b/include/fitz/pixmap.h index 508a304b..ea112405 100644 --- a/include/fitz/pixmap.h +++ b/include/fitz/pixmap.h @@ -16,7 +16,7 @@ struct fz_pixmap_s fz_error *fz_newpixmap(fz_pixmap **mapp, int x, int y, int w, int h, int n); void fz_debugpixmap(fz_pixmap *map); void fz_clearpixmap(fz_pixmap *map); -void fz_freepixmap(fz_pixmap *map); +void fz_droppixmap(fz_pixmap *map); fz_error *fz_convertpixmap(fz_pixmap **dstp, fz_pixmap *src, fz_colorspace *srcs, fz_colorspace *dsts); fz_error *fz_scalepixmap(fz_pixmap **dstp, fz_pixmap *src, int xdenom, int ydenom); diff --git a/include/fitz/render.h b/include/fitz/render.h index dc2f116a..9ff4b3f7 100644 --- a/include/fitz/render.h +++ b/include/fitz/render.h @@ -16,7 +16,7 @@ struct fz_renderer_s }; fz_error *fz_newrenderer(fz_renderer **gcp, fz_colorspace *pcm); -void fz_freerenderer(fz_renderer *gc); +void fz_droprenderer(fz_renderer *gc); fz_error *fz_renderover(fz_renderer *gc, fz_overnode *over, fz_matrix ctm); fz_error *fz_rendermask(fz_renderer *gc, fz_masknode *mask, fz_matrix ctm); diff --git a/include/fitz/scanconv.h b/include/fitz/scanconv.h index 057153c4..8fefe271 100644 --- a/include/fitz/scanconv.h +++ b/include/fitz/scanconv.h @@ -31,12 +31,12 @@ fz_error *fz_newgel(fz_gel **gelp); fz_error *fz_insertgel(fz_gel *gel, float x0, float y0, float x1, float y1); void fz_resetgel(fz_gel *gel, int hs, int vs); void fz_sortgel(fz_gel *gel); -void fz_freegel(fz_gel *gel); +void fz_dropgel(fz_gel *gel); fz_error *fz_newael(fz_ael **aelp); fz_error *fz_insertael(fz_ael *ael, fz_gel *gel, int y, int *e); void fz_advanceael(fz_ael *ael); -void fz_freeael(fz_ael *ael); +void fz_dropael(fz_ael *ael); fz_error *fz_scanconvert(fz_gel *gel, fz_ael *ael, int eofill, int y0, int y1, void (*blitfunc)(int,int,int,unsigned char*,void*), void *blitdata); diff --git a/include/fitz/tree.h b/include/fitz/tree.h index 7181ac9b..a14de20d 100644 --- a/include/fitz/tree.h +++ b/include/fitz/tree.h @@ -138,7 +138,7 @@ struct fz_imagenode_s /* common to all nodes */ void fz_initnode(fz_node *node, fz_nodekind kind); fz_rect fz_boundnode(fz_node *node, fz_matrix ctm); -void fz_freenode(fz_node *node); +void fz_dropnode(fz_node *node); /* branch nodes */ fz_error *fz_newmetanode(fz_node **nodep, fz_obj *name, fz_obj *dict); diff --git a/include/mupdf/content.h b/include/mupdf/content.h index a7bfac22..3f85fe06 100644 --- a/include/mupdf/content.h +++ b/include/mupdf/content.h @@ -101,5 +101,5 @@ fz_error *pdf_showimage(pdf_csi*, pdf_image *img); /* interpret.c */ fz_error *pdf_newcsi(pdf_csi **csip); fz_error *pdf_runcsi(pdf_csi *, pdf_xref *xref, fz_obj *rdb, fz_file *); -void pdf_freecsi(pdf_csi *csi); +void pdf_dropcsi(pdf_csi *csi); diff --git a/include/mupdf/page.h b/include/mupdf/page.h index d4b4bcb0..0dd1001b 100644 --- a/include/mupdf/page.h +++ b/include/mupdf/page.h @@ -53,11 +53,11 @@ struct pdf_page_s /* outline.c */ fz_error *pdf_loadoutlinetree(pdf_outlinetree **oo, pdf_xref *xref); void pdf_debugoutlinetree(pdf_outlinetree *outlinetree); -void pdf_freeoutlinetree(pdf_outlinetree *outlinetree); +void pdf_dropoutlinetree(pdf_outlinetree *outlinetree); /* nametree.c */ fz_error *pdf_loadnametree(pdf_nametree **ntp, pdf_xref *xref, char *key); -void pdf_freenametree(pdf_nametree *nt); +void pdf_dropnametree(pdf_nametree *nt); void pdf_debugnametree(pdf_nametree *nt); fz_obj *pdf_lookupname(pdf_nametree *nt, fz_obj *name); fz_obj *pdf_lookupnames(pdf_nametree *nt, char *name); @@ -67,9 +67,9 @@ fz_error *pdf_loadpagetree(pdf_pagetree **pp, pdf_xref *xref); int pdf_getpagecount(pdf_pagetree *pages); fz_obj *pdf_getpageobject(pdf_pagetree *pages, int p); void pdf_debugpagetree(pdf_pagetree *pages); -void pdf_freepagetree(pdf_pagetree *pages); +void pdf_droppagetree(pdf_pagetree *pages); /* page.c */ fz_error *pdf_loadpage(pdf_page **pagep, pdf_xref *xref, fz_obj *ref); -void pdf_freepage(pdf_page *page); +void pdf_droppage(pdf_page *page); diff --git a/include/mupdf/rsrc.h b/include/mupdf/rsrc.h index 0fb28cf0..8277c5cc 100644 --- a/include/mupdf/rsrc.h +++ b/include/mupdf/rsrc.h @@ -22,7 +22,7 @@ typedef struct pdf_function_s pdf_function; fz_error *pdf_loadfunction(pdf_function **func, pdf_xref *xref, fz_obj *obj); fz_error *pdf_evalfunction(pdf_function *func, float *in, int inlen, float *out, int outlen); -void pdf_freefunction(pdf_function *func); +void pdf_dropfunction(pdf_function *func); /* * ColorSpace @@ -59,7 +59,7 @@ struct pdf_xobject_s }; fz_error *pdf_loadxobject(pdf_xobject **xobjp, pdf_xref *xref, fz_obj *obj); -void pdf_freexobject(pdf_xobject *xobj); +void pdf_dropxobject(pdf_xobject *xobj); /* * Image @@ -136,5 +136,5 @@ fz_error *pdf_loadsubstitutefont(pdf_font *font, int fdflags, char *collection); /* font.c */ fz_error *pdf_loadfontdescriptor(pdf_font *font, pdf_xref *xref, fz_obj *desc, char *collection); fz_error *pdf_loadfont(pdf_font **fontp, pdf_xref *xref, fz_obj *font); -void pdf_freefont(pdf_font *font); +void pdf_dropfont(pdf_font *font); diff --git a/include/mupdf/syntax.h b/include/mupdf/syntax.h index 5d9b1ffb..0df89d65 100644 --- a/include/mupdf/syntax.h +++ b/include/mupdf/syntax.h @@ -52,5 +52,5 @@ fz_error *pdf_newencrypt(pdf_crypt **cp, char *userpw, char *ownerpw, int p, int fz_error *pdf_setpassword(pdf_crypt *crypt, char *pw); fz_error *pdf_cryptstm(fz_filter **fp, pdf_crypt *crypt, int oid, int gid); void pdf_cryptobj(pdf_crypt *crypt, fz_obj *obj, int oid, int gid); -void pdf_freecrypt(pdf_crypt *crypt); +void pdf_dropcrypt(pdf_crypt *crypt); diff --git a/mupdf/build.c b/mupdf/build.c index c2acde08..448d2db4 100644 --- a/mupdf/build.c +++ b/mupdf/build.c @@ -132,7 +132,7 @@ pdf_buildstrokepath(pdf_gstate *gs, fz_pathnode *path) error = fz_endpath(path, FZ_STROKE, &stroke, dash); if (error) { - fz_freedash(dash); + fz_dropdash(dash); return error; } @@ -246,7 +246,7 @@ pdf_showimage(pdf_csi *csi, pdf_image *img) { error = pdf_addfillshape(csi->gstate + csi->gtop, node); if (error) { - fz_freenode(node); + fz_dropnode(node); return error; } } diff --git a/mupdf/cmap.c b/mupdf/cmap.c index ceedcf59..7914bf68 100644 --- a/mupdf/cmap.c +++ b/mupdf/cmap.c @@ -365,7 +365,7 @@ pdf_parsecmap(fz_cmap **cmapp, fz_file *file) return nil; cleanup: - fz_freecmap(cmap); + fz_dropcmap(cmap); *cmapp = nil; return error; } @@ -428,7 +428,7 @@ fflush(stdout); cleanup: if (cmap) - fz_freecmap(cmap); + fz_dropcmap(cmap); fz_dropobj(stmobj); *cmapp = nil; return error; @@ -480,7 +480,7 @@ printf(" system cmap: usecmap %s\n", usecmapname); cleanup: if (*cmapp) - fz_freecmap(*cmapp); + fz_dropcmap(*cmapp); if (file) fz_closefile(file); *cmapp = nil; @@ -498,19 +498,19 @@ pdf_makeidentitycmap(fz_cmap **cmapp, int wmode, int bytes) error = fz_addcodespacerange(*cmapp, 0x0000, 0xffff, bytes); if (error) { - fz_freecmap(*cmapp); + fz_dropcmap(*cmapp); return error; } error = fz_addcidrange(*cmapp, 0x0000, 0xffff, 0); if (error) { - fz_freecmap(*cmapp); + fz_dropcmap(*cmapp); return error; } error = fz_endcidrange(*cmapp); if (error) { - fz_freecmap(*cmapp); + fz_dropcmap(*cmapp); return error; } diff --git a/mupdf/colorspace.c b/mupdf/colorspace.c index b4ba8aa8..5c2ae10f 100644 --- a/mupdf/colorspace.c +++ b/mupdf/colorspace.c @@ -4,14 +4,14 @@ static void initcs(fz_colorspace *cs, char *name, int n, void(*to)(fz_colorspace*,float*,float*), void(*from)(fz_colorspace*,float*,float*), - void(*free)(fz_colorspace*)) + void(*drop)(fz_colorspace*)) { strlcpy(cs->name, name, sizeof cs->name); cs->frozen = 0; cs->n = n; cs->toxyz = to; cs->fromxyz = from; - cs->free = free; + cs->drop = drop; } static void mat3x3inv(float *dst, float *m) @@ -511,7 +511,7 @@ static void separationtoxyz(fz_colorspace *fzcs, float *sep, float *xyz) if (error) { fz_warn("separation: %s", error->msg); - fz_freeerror(error); + fz_droperror(error); xyz[0] = 0; xyz[1] = 0; xyz[2] = 0; @@ -522,11 +522,11 @@ static void separationtoxyz(fz_colorspace *fzcs, float *sep, float *xyz) } static void -freeseparation(fz_colorspace *fzcs) +dropseparation(fz_colorspace *fzcs) { struct separation *cs = (struct separation *)fzcs; - fz_freecolorspace(cs->base); - pdf_freefunction(cs->tint); + fz_dropcolorspace(cs->base); + pdf_dropfunction(cs->tint); } static fz_error * @@ -557,21 +557,21 @@ loadseparation(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) error = pdf_loadfunction(&tint, xref, tintobj); if (error) { - fz_freecolorspace(base); + fz_dropcolorspace(base); return error; } cs = fz_malloc(sizeof(struct separation)); if (!cs) { - pdf_freefunction(tint); - fz_freecolorspace(base); + pdf_dropfunction(tint); + fz_dropcolorspace(base); return fz_outofmem; } initcs((fz_colorspace*)cs, n == 1 ? "Separation" : "DeviceN", n, - separationtoxyz, nil, freeseparation); + separationtoxyz, nil, dropseparation); cs->base = base; cs->tint = tint; @@ -600,10 +600,10 @@ printf("indexedtoxyz: %d\n", i); } static void -freeindexed(fz_colorspace *fzcs) +dropindexed(fz_colorspace *fzcs) { pdf_indexed *cs = (pdf_indexed *)fzcs; - fz_freecolorspace(cs->base); + fz_dropcolorspace(cs->base); fz_free(cs->lookup); } @@ -629,11 +629,11 @@ loadindexed(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) cs = fz_malloc(sizeof(pdf_indexed)); if (!cs) { - fz_freecolorspace(base); + fz_dropcolorspace(base); return fz_outofmem; } - initcs((fz_colorspace*)cs, "Indexed", 1, indexedtoxyz, nil, freeindexed); + initcs((fz_colorspace*)cs, "Indexed", 1, indexedtoxyz, nil, dropindexed); cs->base = base; cs->high = fz_toint(highobj); @@ -643,7 +643,7 @@ loadindexed(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) cs->lookup = fz_malloc(n); if (!cs->lookup) { - freeindexed((fz_colorspace*)cs); + dropindexed((fz_colorspace*)cs); return fz_outofmem; } @@ -663,14 +663,14 @@ loadindexed(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) error = pdf_loadstream(&buf, xref, fz_tonum(lookup), fz_togen(lookup)); if (error) { - freeindexed((fz_colorspace*)cs); + dropindexed((fz_colorspace*)cs); return error; } for (i = 0; i < n && i < (buf->wp - buf->rp); i++) cs->lookup[i] = buf->rp[i]; - fz_freebuffer(buf); + fz_dropbuffer(buf); } *csp = (fz_colorspace*)cs; diff --git a/mupdf/crypt.c b/mupdf/crypt.c index 903176fe..b6b79261 100644 --- a/mupdf/crypt.c +++ b/mupdf/crypt.c @@ -117,7 +117,7 @@ cleanup: } void -pdf_freecrypt(pdf_crypt *crypt) +pdf_dropcrypt(pdf_crypt *crypt) { if (crypt->encrypt) fz_dropobj(crypt->encrypt); if (crypt->id) fz_dropobj(crypt->id); @@ -300,7 +300,7 @@ pdf_newencrypt(pdf_crypt **cp, crypt->n * 8); if (error) { - pdf_freecrypt(crypt); + pdf_dropcrypt(crypt); return error; } diff --git a/mupdf/font.c b/mupdf/font.c index 64961149..1268624d 100644 --- a/mupdf/font.c +++ b/mupdf/font.c @@ -202,11 +202,12 @@ static int mrecode(char *name) * Create and destroy */ -static void ftfreefont(fz_font *font) +static void ftdropfont(fz_font *font) { pdf_font *pfont = (pdf_font*)font; if (pfont->encoding) - fz_freecmap(pfont->encoding); + fz_dropcmap(pfont->encoding); + // XXX free freetype face } static pdf_font * @@ -220,7 +221,7 @@ newfont(char *name) fz_initfont((fz_font*)font, name); font->super.render = ftrender; - font->super.free = (void(*)(fz_font*)) ftfreefont; + font->super.drop = (void(*)(fz_font*)) ftdropfont; font->ftface = nil; font->substitute = 0; @@ -513,7 +514,7 @@ cleanup: fz_free(etable); if (widths) fz_dropobj(widths); - fz_freefont((fz_font*)font); + fz_dropfont((fz_font*)font); *fontp = nil; return error; } @@ -644,7 +645,7 @@ printf(" embedded CMap\n"); map = fz_malloc(len * sizeof(unsigned short)); if (!map) { - fz_freebuffer(buf); + fz_dropbuffer(buf); error = fz_outofmem; goto cleanup; } @@ -657,7 +658,7 @@ printf(" cidtogidmap %d\n", len / 2); font->ncidtogid = len; font->cidtogid = map; - fz_freebuffer(buf); + fz_dropbuffer(buf); } /* TODO: if truetype font is external, cidtogidmap should not be identity */ @@ -797,7 +798,7 @@ printf("\n"); cleanup: if (widths) fz_dropobj(widths); - fz_freefont((fz_font*)font); + fz_dropfont((fz_font*)font); *fontp = nil; return error; } diff --git a/mupdf/function.c b/mupdf/function.c index 44a38e0d..0331607d 100644 --- a/mupdf/function.c +++ b/mupdf/function.c @@ -1387,7 +1387,7 @@ cleanup: } void -pdf_freefunction(pdf_function *func) +pdf_dropfunction(pdf_function *func) { int i; @@ -1419,7 +1419,7 @@ pdf_freefunction(pdf_function *func) fz_free(func->u.st.encode); if(func->u.st.funcs) { for(i = 0; i < func->u.st.k; ++i) - pdf_freefunction(func->u.st.funcs[i]); + pdf_dropfunction(func->u.st.funcs[i]); fz_free(func->u.st.funcs); } @@ -1543,7 +1543,7 @@ cleanup: if(objfunc) fz_dropobj(objfunc); - pdf_freefunction(newfunc); + pdf_dropfunction(newfunc); if(err) return err; return fz_throw("syntaxerror : "); diff --git a/mupdf/image.c b/mupdf/image.c index 2e90d9cb..a9a45f43 100644 --- a/mupdf/image.c +++ b/mupdf/image.c @@ -154,7 +154,7 @@ loadtile(fz_image *img, fz_pixmap *tile) } } - fz_freepixmap(tmp); + fz_droppixmap(tmp); } else @@ -287,7 +287,7 @@ printf(" decode array!\n"); if (img->samples->wp - img->samples->bp < stride * h) { /* TODO: colorspace? */ - fz_freebuffer(img->samples); + fz_dropbuffer(img->samples); fz_free(img); return fz_throw("syntaxerror: truncated image data"); } @@ -307,7 +307,7 @@ printf("]\n"); printf("\n"); img->super.loadtile = loadtile; - img->super.free = nil; + img->super.drop = nil; img->super.cs = cs; img->super.w = w; img->super.h = h; diff --git a/mupdf/interpret.c b/mupdf/interpret.c index cdee9fea..374f23bc 100644 --- a/mupdf/interpret.c +++ b/mupdf/interpret.c @@ -28,7 +28,7 @@ pdf_newcsi(pdf_csi **csip) error = fz_newtree(&csi->tree); if (error) { - fz_freenode((fz_node*)csi->path); + fz_dropnode((fz_node*)csi->path); fz_free(csi); return error; } @@ -59,11 +59,11 @@ clearstack(pdf_csi *csi) } void -pdf_freecsi(pdf_csi *csi) +pdf_dropcsi(pdf_csi *csi) { - if (csi->path) fz_freenode((fz_node*)csi->path); - if (csi->clip) fz_freenode((fz_node*)csi->clip); - if (csi->text) fz_freenode((fz_node*)csi->text); + if (csi->path) fz_dropnode((fz_node*)csi->path); + if (csi->clip) fz_dropnode((fz_node*)csi->clip); + if (csi->text) fz_dropnode((fz_node*)csi->text); clearstack(csi); fz_free(csi); } @@ -175,7 +175,7 @@ runkeyword(pdf_csi *csi, pdf_xref *xref, fz_obj *rdb, char *buf) error = fz_newmetanode(&meta, csi->stack[0], nil); if (error) return error; // error = pdf_beginmarkedcontent(gstate, meta); - // if (error) { fz_freenode(meta); return error; }; + // if (error) { fz_dropnode(meta); return error; }; fz_insertnode(gstate->head, meta); } @@ -187,7 +187,7 @@ runkeyword(pdf_csi *csi, pdf_xref *xref, fz_obj *rdb, char *buf) error = fz_newmetanode(&meta, csi->stack[0], csi->stack[1]); if (error) return error; // error = pdf_beginmarkedcontent(gstate, meta); - // if (error) { fz_freenode(meta); return error; }; + // if (error) { fz_dropnode(meta); return error; }; fz_insertnode(gstate->head, meta); } diff --git a/mupdf/nametree.c b/mupdf/nametree.c index f1898c0e..081d4387 100644 --- a/mupdf/nametree.c +++ b/mupdf/nametree.c @@ -223,7 +223,7 @@ cleanup: } void -pdf_freenametree(pdf_nametree *nt) +pdf_dropnametree(pdf_nametree *nt) { int i; for (i = 0; i < nt->len; i++) { diff --git a/mupdf/outline.c b/mupdf/outline.c index 54cab1d0..afccbf4a 100644 --- a/mupdf/outline.c +++ b/mupdf/outline.c @@ -138,12 +138,12 @@ error: } void -pdf_freeoutline(pdf_outline *outline) +pdf_dropoutline(pdf_outline *outline) { if (outline->first) - pdf_freeoutline(outline->first); + pdf_dropoutline(outline->first); if (outline->next) - pdf_freeoutline(outline->next); + pdf_dropoutline(outline->next); fz_free(outline->title); if (outline->dest) fz_dropobj(outline->dest); @@ -154,10 +154,10 @@ pdf_freeoutline(pdf_outline *outline) } void -pdf_freeoutlinetree(pdf_outlinetree *outlinetree) +pdf_dropoutlinetree(pdf_outlinetree *outlinetree) { if (outlinetree->first) - pdf_freeoutline(outlinetree->first); + pdf_dropoutline(outlinetree->first); fz_free(outlinetree); } diff --git a/mupdf/page.c b/mupdf/page.c index b5e12a4e..79fc6fd0 100644 --- a/mupdf/page.c +++ b/mupdf/page.c @@ -73,7 +73,7 @@ loadpagecontents(fz_tree **treep, pdf_xref *xref, fz_obj *rdb, fz_obj *ref) error = nil; cleanup: - pdf_freecsi(csi); + pdf_dropcsi(csi); return error; } @@ -150,7 +150,7 @@ pdf_loadpage(pdf_page **pagep, pdf_xref *xref, fz_obj *dict) } void -pdf_freepage(pdf_page *page) +pdf_droppage(pdf_page *page) { fz_dropobj(page->resources); fz_droptree(page->tree); diff --git a/mupdf/pagetree.c b/mupdf/pagetree.c index 9f6195e6..6e9b85eb 100644 --- a/mupdf/pagetree.c +++ b/mupdf/pagetree.c @@ -172,7 +172,7 @@ pdf_getpageobject(pdf_pagetree *pages, int p) } void -pdf_freepagetree(pdf_pagetree *pages) +pdf_droppagetree(pdf_pagetree *pages) { int i; for (i = 0; i < pages->count; i++) { diff --git a/mupdf/resources.c b/mupdf/resources.c index a9ab1b7e..068de99b 100644 --- a/mupdf/resources.c +++ b/mupdf/resources.c @@ -382,7 +382,7 @@ printf(" -> %s\n", colorspace->name); return nil; cleanup: - if (colorspace) fz_freecolorspace(colorspace); + if (colorspace) fz_dropcolorspace(colorspace); if (ptr) fz_dropobj(ptr); fz_dropobj(val); return err; @@ -406,45 +406,45 @@ pdf_loadresources(pdf_resources **rdbp, pdf_xref *xref, fz_obj *topdict) rdb->xform = nil; err = fz_newdict(&rdb->extgstate, 5); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } subdict = fz_dictgets(topdict, "ExtGState"); if (subdict) { err = pdf_resolve(&subdict, xref); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } err = loadextgstates(rdb, xref, subdict); fz_dropobj(subdict); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } } err = fz_newdict(&rdb->font, 15); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } err = loadextgstatefonts(rdb, xref); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } subdict = fz_dictgets(topdict, "Font"); if (subdict) { err = pdf_resolve(&subdict, xref); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } err = loadfonts(rdb, xref, subdict); fz_dropobj(subdict); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } } err = fz_newdict(&rdb->colorspace, 5); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } subdict = fz_dictgets(topdict, "ColorSpace"); if (subdict) { err = pdf_resolve(&subdict, xref); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } err = loadcolorspaces(rdb, xref, subdict); fz_dropobj(subdict); - if (err) { pdf_freeresources(rdb); return err; } + if (err) { pdf_dropresources(rdb); return err; } } return nil; diff --git a/mupdf/save.c b/mupdf/save.c index b6cb7a92..8238dc8f 100644 --- a/mupdf/save.c +++ b/mupdf/save.c @@ -21,7 +21,7 @@ writestm(fz_file *out, pdf_xref *xref, pdf_crypt *encrypt, int oid, int gen) error = fz_pushfilter(out, ef); if (error) { - fz_freefilter(ef); + fz_dropfilter(ef); return error; } } diff --git a/mupdf/stream.c b/mupdf/stream.c index 95703f4f..5d39436f 100644 --- a/mupdf/stream.c +++ b/mupdf/stream.c @@ -166,7 +166,7 @@ pdf_isstream(pdf_xref *xref, int oid, int gen) error = pdf_cacheobject(xref, oid, gen); if (error) { fz_warn("%s", error); - fz_freeerror(error); + fz_droperror(error); return 0; } diff --git a/mupdf/xref.c b/mupdf/xref.c index 5dde5f5f..98885f05 100644 --- a/mupdf/xref.c +++ b/mupdf/xref.c @@ -87,7 +87,7 @@ pdf_closepdf(pdf_xref *xref) for (i = 0; i < xref->len; i++) { if (xref->table[i].stmbuf) - fz_freebuffer(xref->table[i].stmbuf); + fz_dropbuffer(xref->table[i].stmbuf); if (xref->table[i].obj) fz_dropobj(xref->table[i].obj); } @@ -227,7 +227,7 @@ pdf_deleteobject(pdf_xref *xref, int oid, int gen) x->gen ++; if (x->stmbuf) - fz_freebuffer(x->stmbuf); + fz_dropbuffer(x->stmbuf); x->stmbuf = nil; if (x->obj) @@ -280,7 +280,7 @@ pdf_updatestream(pdf_xref *xref, int oid, int gen, fz_buffer *stm) x = xref->table + oid; if (x->stmbuf) - fz_freebuffer(x->stmbuf); + fz_dropbuffer(x->stmbuf); x->stmbuf = stm; return nil; diff --git a/object/array.c b/object/array.c index d7beeb38..c57f3952 100644 --- a/object/array.c +++ b/object/array.c @@ -1,5 +1,7 @@ #include <fitz.h> +void fz_droparray(fz_obj *obj); + fz_error * fz_newarray(fz_obj **op, int initialcap) { @@ -40,7 +42,7 @@ fz_copyarray(fz_obj **op, fz_obj *obj) for (i = 0; i < fz_arraylen(obj); i++) { err = fz_arraypush(new, fz_arrayget(obj, i)); - if (err) { fz_freearray(new); return err; } + if (err) { fz_droparray(new); return err; } } return nil; @@ -67,23 +69,23 @@ fz_deepcopyarray(fz_obj **op, fz_obj *obj) if (fz_isarray(val)) { err = fz_deepcopyarray(&val, val); - if (err) { fz_freearray(new); return err; } + if (err) { fz_droparray(new); return err; } err = fz_arraypush(new, val); - if (err) { fz_dropobj(val); fz_freearray(new); return err; } + if (err) { fz_dropobj(val); fz_droparray(new); return err; } fz_dropobj(val); } else if (fz_isdict(val)) { err = fz_deepcopydict(&val, val); - if (err) { fz_freearray(new); return err; } + if (err) { fz_droparray(new); return err; } err = fz_arraypush(new, val); - if (err) { fz_dropobj(val); fz_freearray(new); return err; } + if (err) { fz_dropobj(val); fz_droparray(new); return err; } fz_dropobj(val); } else { err = fz_arraypush(new, val); - if (err) { fz_freearray(new); return err; } + if (err) { fz_droparray(new); return err; } } } @@ -166,7 +168,7 @@ fz_arraypush(fz_obj *obj, fz_obj *item) } void -fz_freearray(fz_obj *obj) +fz_droparray(fz_obj *obj) { int i; diff --git a/object/dict.c b/object/dict.c index fd2f3382..61e55bc4 100644 --- a/object/dict.c +++ b/object/dict.c @@ -1,5 +1,7 @@ #include <fitz.h> +void fz_dropdict(fz_obj *obj); + fz_error * fz_newdict(fz_obj **op, int initialcap) { @@ -42,7 +44,7 @@ fz_copydict(fz_obj **op, fz_obj *obj) for (i = 0; i < fz_dictlen(obj); i++) { err = fz_dictput(new, fz_dictgetkey(obj, i), fz_dictgetval(obj, i)); - if (err) { fz_freedict(new); return err; } + if (err) { fz_dropdict(new); return err; } } return nil; @@ -69,23 +71,23 @@ fz_deepcopydict(fz_obj **op, fz_obj *obj) if (fz_isarray(val)) { err = fz_deepcopyarray(&val, val); - if (err) { fz_freedict(new); return err; } + if (err) { fz_dropdict(new); return err; } err = fz_dictput(new, fz_dictgetkey(obj, i), val); - if (err) { fz_dropobj(val); fz_freedict(new); return err; } + if (err) { fz_dropobj(val); fz_dropdict(new); return err; } fz_dropobj(val); } else if (fz_isdict(val)) { err = fz_deepcopydict(&val, val); - if (err) { fz_freedict(new); return err; } + if (err) { fz_dropdict(new); return err; } err = fz_dictput(new, fz_dictgetkey(obj, i), val); - if (err) { fz_dropobj(val); fz_freedict(new); return err; } + if (err) { fz_dropobj(val); fz_dropdict(new); return err; } fz_dropobj(val); } else { err = fz_dictput(new, fz_dictgetkey(obj, i), val); - if (err) { fz_freedict(new); return err; } + if (err) { fz_dropdict(new); return err; } } } @@ -240,7 +242,7 @@ fz_dictdel(fz_obj *obj, fz_obj *key) } void -fz_freedict(fz_obj *obj) +fz_dropdict(fz_obj *obj) { int i; diff --git a/object/parse.c b/object/parse.c index c065a132..99211243 100644 --- a/object/parse.c +++ b/object/parse.c @@ -151,7 +151,7 @@ static fz_error *parsedict(fz_obj **obj, char **sp, struct vap *v) error: if (val) fz_dropobj(val); if (key) fz_dropobj(key); - if (dict) fz_freedict(dict); + if (dict) fz_dropobj(dict); *obj = nil; *sp = s; return err; @@ -180,10 +180,10 @@ static fz_error *parsearray(fz_obj **obj, char **sp, struct vap *v) } err = parseobj(&o, &s, v); - if (err) { *obj = nil; fz_freearray(a); return err; } + if (err) { *obj = nil; fz_dropobj(a); return err; } err = fz_arraypush(a, o); - if (err) { fz_dropobj(o); *obj = nil; fz_freearray(a); return err; } + if (err) { fz_dropobj(o); *obj = nil; fz_dropobj(a); return err; } fz_dropobj(o); } diff --git a/object/simple.c b/object/simple.c index bee7cf46..953dcfa7 100644 --- a/object/simple.c +++ b/object/simple.c @@ -1,5 +1,8 @@ #include <fitz.h> +extern void fz_droparray(fz_obj *array); +extern void fz_dropdict(fz_obj *dict); + #define NEWOBJ(KIND,SIZE) \ fz_obj *o; \ o = *op = fz_malloc(SIZE); \ @@ -85,9 +88,9 @@ fz_dropobj(fz_obj *o) o->refcount --; if (o->refcount == 0) { if (o->kind == FZ_ARRAY) - fz_freearray(o); + fz_droparray(o); else if (o->kind == FZ_DICT) - fz_freedict(o); + fz_dropdict(o); else fz_free(o); } diff --git a/render/edgelist.c b/render/edgelist.c index d62ffad4..9bcc92b1 100644 --- a/render/edgelist.c +++ b/render/edgelist.c @@ -46,7 +46,7 @@ fz_resetgel(fz_gel *gel, int hs, int vs) } void -fz_freegel(fz_gel *gel) +fz_dropgel(fz_gel *gel) { fz_free(gel->edges); fz_free(gel); @@ -196,7 +196,7 @@ fz_newael(fz_ael **aelp) } void -fz_freeael(fz_ael *ael) +fz_dropael(fz_ael *ael) { fz_free(ael->edges); fz_free(ael); diff --git a/render/glyphcache.c b/render/glyphcache.c index beb77ccc..e92b472e 100644 --- a/render/glyphcache.c +++ b/render/glyphcache.c @@ -103,7 +103,7 @@ cleanup: } void -fz_freeglyphcache(fz_glyphcache *arena) +fz_dropglyphcache(fz_glyphcache *arena) { fz_free(arena->hash); fz_free(arena->lru); diff --git a/render/pixmap.c b/render/pixmap.c index acb1d1d2..634fe8f6 100644 --- a/render/pixmap.c +++ b/render/pixmap.c @@ -27,7 +27,7 @@ fz_newpixmap(fz_pixmap **pixp, int x, int y, int w, int h, int n) } void -fz_freepixmap(fz_pixmap *pix) +fz_droppixmap(fz_pixmap *pix) { fz_free(pix->samples); fz_free(pix); diff --git a/render/render.c b/render/render.c index d1eb6136..6b2d5e29 100644 --- a/render/render.c +++ b/render/render.c @@ -42,29 +42,29 @@ fz_newrenderer(fz_renderer **gcp, fz_colorspace *processcolormodel) cleanup: if (gc->cache) - fz_freeglyphcache(gc->cache); + fz_dropglyphcache(gc->cache); if (gc->gel) - fz_freegel(gc->gel); + fz_dropgel(gc->gel); if (gc->ael) - fz_freeael(gc->ael); + fz_dropael(gc->ael); fz_free(gc); return error; } void -fz_freerenderer(fz_renderer *gc) +fz_droprenderer(fz_renderer *gc) { if (gc->cache) - fz_freeglyphcache(gc->cache); + fz_dropglyphcache(gc->cache); if (gc->gel) - fz_freegel(gc->gel); + fz_dropgel(gc->gel); if (gc->ael) - fz_freeael(gc->ael); + fz_dropael(gc->ael); if (gc->tmp) - fz_freepixmap(gc->tmp); + fz_droppixmap(gc->tmp); if (gc->acc) - fz_freepixmap(gc->acc); + fz_droppixmap(gc->acc); fz_free(gc); } @@ -125,7 +125,7 @@ fz_renderoverchild(fz_renderer *gc, fz_node *node, fz_matrix ctm) //printf("over dst ");fz_debugpixmap(gc->acc);getchar(); fz_blendover(gc->tmp, gc->acc); //printf("over res ");fz_debugpixmap(gc->acc);getchar(); - fz_freepixmap(gc->tmp); + fz_droppixmap(gc->tmp); gc->tmp = nil; } @@ -229,8 +229,8 @@ if (!shapepix) return nil; //printf("mask shape");fz_debugpixmap(shapepix);getchar(); //printf("mask blend");fz_debugpixmap(gc->tmp);getchar(); - fz_freepixmap(shapepix); - fz_freepixmap(colorpix); + fz_droppixmap(shapepix); + fz_droppixmap(colorpix); gc->mode = oldmode; diff --git a/render/renderimage.c b/render/renderimage.c index 37c32fae..c82d411c 100644 --- a/render/renderimage.c +++ b/render/renderimage.c @@ -185,7 +185,7 @@ printf("renderimage s=%gx%g/%dx%d d=%d,%d\n", sx, sy, w, h, dx, dy); error = fz_newpixmap(&tile1, 0, 0, w, h, n + 1); -printf(" load tile\n"); +printf(" load tile %d x %d\n", w, h); error = image->loadtile(image, tile1); //fz_debugpixmap(tile1);getchar(); @@ -195,7 +195,7 @@ printf(" scale tile 1/%d x 1/%d\n", dx, dy); // fz_gammapixmap(tile1, 1.0 / GAMMA); error = fz_scalepixmap(&tile2, tile1, dx, dy); // fz_gammapixmap(tile2, GAMMA); - fz_freepixmap(tile1); + fz_droppixmap(tile1); } else tile2 = tile1; @@ -203,7 +203,7 @@ printf(" scale tile 1/%d x 1/%d\n", dx, dy); /* render image mask */ if (n == 0 && a == 1) { -printf("draw image mask\n"); +printf(" draw image mask\n"); error = fz_newpixmap(&gc->tmp, gc->x, gc->y, gc->w, gc->h, 1); fz_clearpixmap(gc->tmp); error = drawtile(gc, gc->tmp, tile2, ctm, 0); @@ -212,23 +212,22 @@ printf("draw image mask\n"); /* render rgb over */ else if (n == 3 && a == 0 && gc->acc) { -printf("draw image rgb over\n"); +printf(" draw image rgb over\n"); error = drawtile(gc, gc->acc, tile2, ctm, 1); } /* render generic image */ else { -printf("draw generic image\n"); +printf(" draw image rgb over after cs transform\n"); error = fz_convertpixmap(&tile3, tile2, cs, gc->model); error = fz_newpixmap(&gc->tmp, gc->x, gc->y, gc->w, gc->h, gc->model->n + 1); fz_clearpixmap(gc->tmp); - error = drawtile(gc, gc->tmp, tile3, ctm, 0); -//fz_debugpixmap(gc->tmp);getchar(); - fz_freepixmap(tile3); + error = drawtile(gc, gc->tmp, tile3, ctm, 1); + fz_droppixmap(tile3); } - fz_freepixmap(tile2); + fz_droppixmap(tile2); return nil; } diff --git a/test/pdffunction.c b/test/pdffunction.c index c67e60d7..20dabf1e 100644 --- a/test/pdffunction.c +++ b/test/pdffunction.c @@ -243,7 +243,7 @@ int main(int argc, char **argv) fprintf(stderr, "output[%d] : %f\n", i, out[i]); fz_dropobj(funcobj); - pdf_freefunction(func); + pdf_dropfunction(func); } } diff --git a/test/pdfmerge.c b/test/pdfmerge.c index 0ccaeaa4..732f30c7 100644 --- a/test/pdfmerge.c +++ b/test/pdfmerge.c @@ -131,7 +131,7 @@ int main(int argc, char **argv) fz_abort(error); } - pdf_freepagetree(srcpages); + pdf_droppagetree(srcpages); pdf_closepdf(src); } diff --git a/test/pdfrip.c b/test/pdfrip.c index 986e61a9..2f79f334 100644 --- a/test/pdfrip.c +++ b/test/pdfrip.c @@ -70,9 +70,9 @@ printf("rendering!\n"); printf("done!\n"); fz_debugpixmap(pix); - fz_freepixmap(pix); + fz_droppixmap(pix); - fz_freerenderer(gc); + fz_droprenderer(gc); } } @@ -122,7 +122,7 @@ int main(int argc, char **argv) outlines = nil; error = pdf_loadoutlinetree(&outlines, xref); - if (error) { fz_warn(error->msg); fz_freeerror(error); } + if (error) { fz_warn(error->msg); fz_droperror(error); } if (optind == argc) { diff --git a/test/x11pdf.c b/test/x11pdf.c index a1c3372f..4784f220 100644 --- a/test/x11pdf.c +++ b/test/x11pdf.c @@ -140,7 +140,7 @@ static void showpage(void) XFlush(xdpy); if (image) - fz_freepixmap(image); + fz_droppixmap(image); image = nil; sprintf(s, "Loading page %d", pageno); @@ -170,7 +170,7 @@ static void showpage(void) if (error) fz_abort(error); - pdf_freepage(page); + pdf_droppage(page); XDefineCursor(xdpy, xwin, xcarrow); XFlush(xdpy); diff --git a/tree/cmap.c b/tree/cmap.c index 21b08274..d44ac117 100644 --- a/tree/cmap.c +++ b/tree/cmap.c @@ -66,10 +66,10 @@ fz_newcmap(fz_cmap **cmapp) } void -fz_freecmap(fz_cmap *cmap) +fz_dropcmap(fz_cmap *cmap) { if (cmap->usecmap) - fz_freecmap(cmap->usecmap); + fz_dropcmap(cmap->usecmap); fz_free(cmap->ranges); fz_free(cmap->lookup); fz_free(cmap); diff --git a/tree/colorspace.c b/tree/colorspace.c index 6b4766c2..70456aae 100644 --- a/tree/colorspace.c +++ b/tree/colorspace.c @@ -1,12 +1,12 @@ #include <fitz.h> void -fz_freecolorspace(fz_colorspace *cs) +fz_dropcolorspace(fz_colorspace *cs) { if (cs->frozen) return; - if (cs->free) - cs->free(cs); + if (cs->drop) + cs->drop(cs); fz_free(cs); } diff --git a/tree/font.c b/tree/font.c index 58c194ae..28045f5d 100644 --- a/tree/font.c +++ b/tree/font.c @@ -217,10 +217,10 @@ notfound: } void -fz_freefont(fz_font *font) +fz_dropfont(fz_font *font) { - if (font->free) - font->free(font); + if (font->drop) + font->drop(font); fz_free(font->hmtx); fz_free(font->vmtx); fz_free(font); diff --git a/tree/image.c b/tree/image.c index dd4b030a..16a1c817 100644 --- a/tree/image.c +++ b/tree/image.c @@ -1,9 +1,9 @@ #include <fitz.h> -void fz_freeimage(fz_image *image) +void fz_dropimage(fz_image *image) { - if (image->free) - image->free(image); + if (image->drop) + image->drop(image); fz_free(image); } diff --git a/tree/node1.c b/tree/node1.c index 26ce614f..2d98d63d 100644 --- a/tree/node1.c +++ b/tree/node1.c @@ -1,10 +1,10 @@ #include <fitz.h> -void fz_freemetanode(fz_metanode* node); -void fz_freelinknode(fz_linknode* node); -void fz_freepathnode(fz_pathnode* node); -void fz_freetextnode(fz_textnode* node); -void fz_freeimagenode(fz_imagenode* node); +void fz_dropmetanode(fz_metanode* node); +void fz_droplinknode(fz_linknode* node); +void fz_droppathnode(fz_pathnode* node); +void fz_droptextnode(fz_textnode* node); +void fz_dropimagenode(fz_imagenode* node); fz_rect fz_boundtransformnode(fz_transformnode* node, fz_matrix ctm); fz_rect fz_boundovernode(fz_overnode* node, fz_matrix ctm); @@ -28,12 +28,12 @@ fz_initnode(fz_node *node, fz_nodekind kind) } void -fz_freenode(fz_node *node) +fz_dropnode(fz_node *node) { if (node->child) - fz_freenode(node->child); + fz_dropnode(node->child); if (node->next) - fz_freenode(node->next); + fz_dropnode(node->next); switch (node->kind) { @@ -44,22 +44,22 @@ fz_freenode(fz_node *node) case FZ_NCOLOR: break; case FZ_NPATH: - fz_freepathnode((fz_pathnode *) node); + fz_droppathnode((fz_pathnode *) node); break; case FZ_NTEXT: - fz_freetextnode((fz_textnode *) node); + fz_droptextnode((fz_textnode *) node); break; case FZ_NIMAGE: - fz_freeimagenode((fz_imagenode *) node); + fz_dropimagenode((fz_imagenode *) node); break; case FZ_NSHADE: - // XXX fz_freeshadenode((fz_shadenode *) node); + // XXX fz_dropshadenode((fz_shadenode *) node); break; case FZ_NLINK: - fz_freelinknode((fz_linknode *) node); + fz_droplinknode((fz_linknode *) node); break; case FZ_NMETA: - fz_freemetanode((fz_metanode *) node); + fz_dropmetanode((fz_metanode *) node); break; } diff --git a/tree/node2.c b/tree/node2.c index 6e28aaac..0af3ab7d 100644 --- a/tree/node2.c +++ b/tree/node2.c @@ -186,7 +186,7 @@ fz_newmetanode(fz_node **nodep, fz_obj *name, fz_obj *dict) } void -fz_freemetanode(fz_metanode *node) +fz_dropmetanode(fz_metanode *node) { if (node->name) fz_dropobj(node->name); @@ -223,7 +223,7 @@ fz_newlinknode(fz_node **nodep, fz_tree *subtree) } void -fz_freelinknode(fz_linknode *node) +fz_droplinknode(fz_linknode *node) { fz_droptree(node->tree); } @@ -285,7 +285,7 @@ fz_newimagenode(fz_node **nodep, fz_image *image) } void -fz_freeimagenode(fz_imagenode *node) +fz_dropimagenode(fz_imagenode *node) { // XXX fz_dropimage(node->image); } diff --git a/tree/path.c b/tree/path.c index 268e5dae..74e29a59 100644 --- a/tree/path.c +++ b/tree/path.c @@ -55,7 +55,7 @@ fz_clonepath(fz_pathnode **pathp, fz_pathnode *oldpath) } void -fz_freepathnode(fz_pathnode *node) +fz_droppathnode(fz_pathnode *node) { fz_free(node->dash); fz_free(node->els); @@ -294,7 +294,7 @@ fz_newdash(fz_dash **dashp, float phase, int len, float *array) } void -fz_freedash(fz_dash *dash) +fz_dropdash(fz_dash *dash) { fz_free(dash); } diff --git a/tree/text.c b/tree/text.c index 1832df9f..951fdada 100644 --- a/tree/text.c +++ b/tree/text.c @@ -21,7 +21,7 @@ fz_newtextnode(fz_textnode **textp, fz_font *font) } void -fz_freetextnode(fz_textnode *text) +fz_droptextnode(fz_textnode *text) { fz_free(text->els); } diff --git a/tree/tree.c b/tree/tree.c index 12bbc822..85521cdc 100644 --- a/tree/tree.c +++ b/tree/tree.c @@ -31,7 +31,7 @@ fz_droptree(fz_tree *tree) if (tree->refcount == 0) { if (tree->root) - fz_freenode(tree->root); + fz_dropnode(tree->root); fz_free(tree); } } |