]> www.fi.muni.cz Git - evince.git/commitdiff
Rename xmalloc to mdvi_malloc to avoid libtool conflict, update year in
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Thu, 23 Jun 2005 21:05:32 +0000 (21:05 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Thu, 23 Jun 2005 21:05:32 +0000 (21:05 +0000)
copyright.

24 files changed:
ChangeLog
dvi/mdvi-lib/bitmap.c
dvi/mdvi-lib/color.c
dvi/mdvi-lib/common.c
dvi/mdvi-lib/common.h
dvi/mdvi-lib/dvimisc.c
dvi/mdvi-lib/dviread.c
dvi/mdvi-lib/font.c
dvi/mdvi-lib/fontmap.c
dvi/mdvi-lib/fontsrch.c
dvi/mdvi-lib/gf.c
dvi/mdvi-lib/hash.c
dvi/mdvi-lib/pagesel.c
dvi/mdvi-lib/paper.c
dvi/mdvi-lib/pk.c
dvi/mdvi-lib/sp-epsf.c
dvi/mdvi-lib/special.c
dvi/mdvi-lib/t1.c
dvi/mdvi-lib/tfm.c
dvi/mdvi-lib/tfmfile.c
dvi/mdvi-lib/tt.c
dvi/mdvi-lib/util.c
dvi/mdvi-lib/vf.c
shell/ev-window.c

index b8abbe2f9a1e0f5a22871fdd477f64b2edd39ed5..72a0b71b9e94921d3a6623615487bee3f2fb1dad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2005-06-24  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * dvi/mdvi-lib/bitmap.c: (bitmap_alloc), (bitmap_alloc_raw),
+       (bitmap_flip_horizontally), (bitmap_flip_vertically),
+       (bitmap_flip_diagonally), (bitmap_rotate_clockwise),
+       (bitmap_rotate_counter_clockwise), (bitmap_flip_rotate_clockwise),
+       (bitmap_flip_rotate_counter_clockwise):
+       * dvi/mdvi-lib/color.c: (mdvi_push_color), (get_color_table):
+       * dvi/mdvi-lib/common.c: (read_string), (buff_free), (buff_add),
+       (buff_gets):
+       * dvi/mdvi-lib/common.h:
+       * dvi/mdvi-lib/dvimisc.c: (mdvi_push_color):
+       * dvi/mdvi-lib/dviread.c: (get_bytes), (dreset), (define_font),
+       (opendvi), (mdvi_reload), (mdvi_init_context),
+       (mdvi_destroy_context), (mdvi_dopage), (special):
+       * dvi/mdvi-lib/font.c: (font_drop_one), (font_free_unused):
+       * dvi/mdvi-lib/fontmap.c: (read_encoding), (destroy_encoding),
+       (file_hash_free), (register_encoding), (parse_spec),
+       (mdvi_load_fontmap), (free_ent), (mdvi_init_fontmaps),
+       (mdvi_add_fontmap_file), (mdvi_ps_read_fontmap),
+       (mdvi_ps_flush_fonts), (mdvi_ps_find_font), (mdvi_ps_get_metrics):
+       * dvi/mdvi-lib/fontsrch.c: (mdvi_list_font_class),
+       (mdvi_register_font_type), (mdvi_unregister_font_type),
+       (lookup_font), (mdvi_add_font), (mdvi_font_retry):
+       * dvi/mdvi-lib/gf.c: (gf_read_bitmap), (gf_load_font):
+       * dvi/mdvi-lib/hash.c: (mdvi_hash_remove), (mdvi_hash_remove_ptr),
+       (mdvi_hash_destroy_key), (mdvi_hash_reset):
+       * dvi/mdvi-lib/pagesel.c: (mdvi_parse_range),
+       (mdvi_parse_page_spec), (mdvi_free_page_spec), (main):
+       * dvi/mdvi-lib/paper.c: (mdvi_free_paper_specs):
+       * dvi/mdvi-lib/pk.c: (pk_lookup), (pk_lookupn), (pk_load_font):
+       * dvi/mdvi-lib/sp-epsf.c: (epsf_special):
+       * dvi/mdvi-lib/special.c: (mdvi_register_special),
+       (mdvi_unregister_special), (mdvi_flush_specials):
+       * dvi/mdvi-lib/t1.c: (t1_lookup_font), (t1_really_load_font),
+       (t1_font_remove):
+       * dvi/mdvi-lib/tfm.c: (get_tfm_chars):
+       * dvi/mdvi-lib/tfmfile.c: (afm_load_file), (tfm_load_file),
+       (ofm1_load_file), (ofm_load_file), (get_font_metrics),
+       (free_font_metrics), (flush_font_metrics):
+       * dvi/mdvi-lib/tt.c: (tt_really_load_font), (tt_get_bitmap),
+       (tt_font_remove):
+       * dvi/mdvi-lib/util.c: (mdvi_malloc), (mdvi_realloc),
+       (mdvi_calloc), (mdvi_free), (mdvi_strdup), (mdvi_strncpy),
+       (mdvi_strndup), (mdvi_memdup), (xstradd), (dstring_append),
+       (dstring_insert), (dstring_new), (dstring_reset):
+       * dvi/mdvi-lib/vf.c: (vf_load_font), (vf_free_macros):
+       
+       Rename xmalloc and xfree to mdvi_malloc and mdvi_free to
+       avoid conflict with libtool on FC4
+       
+       * shell/ev-window.c: (ev_window_cmd_help_about):
+       
+       Update copyright year. Fix for bug 308828.
+
 2005-06-23  Nikolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-view.c: (add_scroll_binding_keypad),
index a48e6e05c53931777aa7b91dfc1b9006f6a9468b..9014dba6000d821cf7e3f4ca42061fa76c19cdcf 100644 (file)
@@ -210,7 +210,7 @@ BITMAP      *bitmap_alloc(int w, int h)
        bm->height = h;
        bm->stride = BM_BYTES_PER_LINE(bm);
        if(h && bm->stride)
-               bm->data = (BmUnit *)xcalloc(h, bm->stride);
+               bm->data = (BmUnit *)mdvi_calloc(h, bm->stride);
        else
                bm->data = NULL;
        
@@ -226,7 +226,7 @@ BITMAP      *bitmap_alloc_raw(int w, int h)
        bm->height = h;
        bm->stride = BM_BYTES_PER_LINE(bm);
        if(h && bm->stride)
-               bm->data = (BmUnit *)xmalloc(h * bm->stride);
+               bm->data = (BmUnit *)mdvi_malloc(h * bm->stride);
        else
                bm->data = NULL;
        
@@ -386,7 +386,7 @@ void bitmap_flip_horizontally(BITMAP *bm)
        nb.width = bm->width;
        nb.height = bm->height;
        nb.stride = bm->stride;
-       nb.data = xcalloc(bm->height, bm->stride);
+       nb.data = mdvi_calloc(bm->height, bm->stride);
                
        fptr = bm->data;
        tptr = __bm_unit_ptr(&nb, nb.width-1, 0);
@@ -416,7 +416,7 @@ void bitmap_flip_horizontally(BITMAP *bm)
        }
        DEBUG((DBG_BITMAP_OPS, "flip_horizontally (%d,%d) -> (%d,%d)\n",
                bm->width, bm->height, nb.width, nb.height));
-       xfree(bm->data);
+       mdvi_free(bm->data);
        bm->data = nb.data;
        if(SHOW_OP_DATA)
                bitmap_print(stderr, bm);
@@ -432,7 +432,7 @@ void        bitmap_flip_vertically(BITMAP *bm)
        nb.width = bm->width;
        nb.height = bm->height;
        nb.stride = bm->stride;
-       nb.data = xcalloc(bm->height, bm->stride);
+       nb.data = mdvi_calloc(bm->height, bm->stride);
        
        fptr = bm->data;
        tptr = __bm_unit_ptr(&nb, 0, nb.height-1);
@@ -457,7 +457,7 @@ void        bitmap_flip_vertically(BITMAP *bm)
        }
        DEBUG((DBG_BITMAP_OPS, "flip_vertically (%d,%d) -> (%d,%d)\n",
                bm->width, bm->height, nb.width, nb.height));
-       xfree(bm->data);
+       mdvi_free(bm->data);
        bm->data = nb.data;
        if(SHOW_OP_DATA)
                bitmap_print(stderr, bm);
@@ -473,7 +473,7 @@ void        bitmap_flip_diagonally(BITMAP *bm)
        nb.width = bm->width;
        nb.height = bm->height;
        nb.stride = bm->stride;
-       nb.data = xcalloc(bm->height, bm->stride);
+       nb.data = mdvi_calloc(bm->height, bm->stride);
        
        fptr = bm->data;
        tptr = __bm_unit_ptr(&nb, nb.width-1, nb.height-1);
@@ -503,7 +503,7 @@ void        bitmap_flip_diagonally(BITMAP *bm)
        }
        DEBUG((DBG_BITMAP_OPS, "flip_diagonally (%d,%d) -> (%d,%d)\n",
                bm->width, bm->height, nb.width, nb.height));
-       xfree(bm->data);
+       mdvi_free(bm->data);
        bm->data = nb.data;
        if(SHOW_OP_DATA)
                bitmap_print(stderr, bm);
@@ -519,7 +519,7 @@ void        bitmap_rotate_clockwise(BITMAP *bm)
        nb.width = bm->height;
        nb.height = bm->width;
        nb.stride = BM_BYTES_PER_LINE(&nb);
-       nb.data = xcalloc(nb.height, nb.stride);
+       nb.data = mdvi_calloc(nb.height, nb.stride);
        
        fptr = bm->data;
        tptr = __bm_unit_ptr(&nb, nb.width - 1, 0);
@@ -552,7 +552,7 @@ void        bitmap_rotate_clockwise(BITMAP *bm)
 
        DEBUG((DBG_BITMAP_OPS, "rotate_clockwise (%d,%d) -> (%d,%d)\n",
                bm->width, bm->height, nb.width, nb.height));
-       xfree(bm->data);
+       mdvi_free(bm->data);
        bm->data = nb.data;
        bm->width = nb.width;
        bm->height = nb.height; 
@@ -571,7 +571,7 @@ void        bitmap_rotate_counter_clockwise(BITMAP *bm)
        nb.width = bm->height;
        nb.height = bm->width;
        nb.stride = BM_BYTES_PER_LINE(&nb);
-       nb.data = xcalloc(nb.height, nb.stride);
+       nb.data = mdvi_calloc(nb.height, nb.stride);
        
        fptr = bm->data;
        tptr = __bm_unit_ptr(&nb, 0, nb.height - 1);
@@ -604,7 +604,7 @@ void        bitmap_rotate_counter_clockwise(BITMAP *bm)
 
        DEBUG((DBG_BITMAP_OPS, "rotate_counter_clockwise (%d,%d) -> (%d,%d)\n",
                bm->width, bm->height, nb.width, nb.height));
-       xfree(bm->data);
+       mdvi_free(bm->data);
        bm->data = nb.data;
        bm->width = nb.width;
        bm->height = nb.height; 
@@ -623,7 +623,7 @@ void        bitmap_flip_rotate_clockwise(BITMAP *bm)
        nb.width = bm->height;
        nb.height = bm->width;
        nb.stride = BM_BYTES_PER_LINE(&nb);
-       nb.data = xcalloc(nb.height, nb.stride);
+       nb.data = mdvi_calloc(nb.height, nb.stride);
        
        fptr = bm->data;
        tptr = __bm_unit_ptr(&nb, nb.width-1, nb.height-1);
@@ -655,7 +655,7 @@ void        bitmap_flip_rotate_clockwise(BITMAP *bm)
        }
        DEBUG((DBG_BITMAP_OPS, "flip_rotate_clockwise (%d,%d) -> (%d,%d)\n",
                bm->width, bm->height, nb.width, nb.height));
-       xfree(bm->data);
+       mdvi_free(bm->data);
        bm->data = nb.data;
        bm->width = nb.width;
        bm->height = nb.height; 
@@ -674,7 +674,7 @@ void        bitmap_flip_rotate_counter_clockwise(BITMAP *bm)
        nb.width = bm->height;
        nb.height = bm->width;
        nb.stride = BM_BYTES_PER_LINE(&nb);
-       nb.data = xcalloc(nb.height, nb.stride);
+       nb.data = mdvi_calloc(nb.height, nb.stride);
        
        fptr = bm->data;
        tptr = nb.data;
@@ -707,7 +707,7 @@ void        bitmap_flip_rotate_counter_clockwise(BITMAP *bm)
 
        DEBUG((DBG_BITMAP_OPS, "flip_rotate_counter_clockwise (%d,%d) -> (%d,%d)\n",
                bm->width, bm->height, nb.width, nb.height));
-       xfree(bm->data);
+       mdvi_free(bm->data);
        bm->data = nb.data;
        bm->width = nb.width;
        bm->height = nb.height; 
index ae63a873167484bf0ed2c456c7cec2074b8372ce..366b0ea6814b984552b0b8fdab14293c79aee696 100644 (file)
@@ -34,7 +34,7 @@ void  mdvi_push_color(DviContext *dvi, Ulong fg, Ulong bg)
 {
        if(dvi->color_top == dvi->color_size) {
                dvi->color_size += 32;
-               dvi->color_stack = xrealloc(dvi->color_stack,
+               dvi->color_stack = mdvi_realloc(dvi->color_stack,
                        dvi->color_size * sizeof(DviColorPair));
        }
        dvi->color_stack[dvi->color_top].fg = dvi->curr_fg;
@@ -115,13 +115,13 @@ Ulong     *get_color_table(DviDevice *dev,
                cc->pixels = NULL;
        } else {
                cc = tofree;
-               xfree(cc->pixels);
+               mdvi_free(cc->pixels);
        }
        pixels = xnalloc(Ulong, nlevels);
        status = dev->alloc_colors(dev->device_data, 
                pixels, nlevels, fg, bg, gamma, density);
        if(status < 0) {
-               xfree(pixels);
+               mdvi_free(pixels);
                return NULL;
        }
        cc->fg = fg;
index cf714eb9300c9eb6f71d35b279ee9596860787af..70066828af1167e35506bf1f765c97d0f56eca36 100644 (file)
@@ -72,9 +72,9 @@ char  *read_string(FILE *in, int s, char *buffer, size_t len)
        
        n = fugetn(in, s ? s : 1);
        if((str = buffer) == NULL || n + 1 > len)
-               str = xmalloc(n + 1);
+               str = mdvi_malloc(n + 1);
        if(fread(str, 1, n, in) != n) {
-               if(str != buffer) xfree(str);
+               if(str != buffer) mdvi_free(str);
                return NULL;
        }
        str[n] = 0;
@@ -139,7 +139,7 @@ static Int32        scaled_width(Int32 fix, int scale)
 void   buff_free(Buffer *buf)
 {
        if(buf->data)
-               xfree(buf->data);
+               mdvi_free(buf->data);
        buff_init(buf); 
 }
 
@@ -156,7 +156,7 @@ size_t      buff_add(Buffer *buf, const char *data, size_t len)
                len = strlen(data);
        if(buf->length + len + 1 > buf->size) {
                buf->size = buf->length + len + 256;
-               buf->data = xrealloc(buf->data, buf->size);
+               buf->data = mdvi_realloc(buf->data, buf->size);
        }
        memcpy(buf->data + buf->length, data, len);
        buf->length += len;
@@ -174,7 +174,7 @@ char        *buff_gets(Buffer *buf, size_t *length)
                return NULL;
        ptr++; /* include newline */
        len = ptr - buf->data;
-       ret = xmalloc(len + 1);
+       ret = mdvi_malloc(len + 1);
        if(len > 0) {
                memcpy(ret, buf->data, len);
                memmove(buf->data, buf->data + len, buf->length - len);
index e9c007ed7afbd261734a5ddc929aa26ac21fc6e1..fe4d6f7084f88db0095633d12f9c9afa9cc09efb 100644 (file)
@@ -202,19 +202,19 @@ extern void __debug __PROTO((int, const char *, ...));
 
 /* memory allocation */
 
-extern void  xfree __PROTO((void *));
-extern void *xmalloc __PROTO((size_t));
-extern void *xrealloc __PROTO((void *, size_t));
-extern void *xcalloc __PROTO((size_t, size_t));
-extern char *xstrncpy __PROTO((char *, const char *, size_t));
-extern char *xstrdup __PROTO((const char *));
-extern char *xstrndup __PROTO((const char *, size_t));
-extern void *xmemdup __PROTO((const void *, size_t));
+extern void  mdvi_free __PROTO((void *));
+extern void *mdvi_malloc __PROTO((size_t));
+extern void *mdvi_realloc __PROTO((void *, size_t));
+extern void *mdvi_calloc __PROTO((size_t, size_t));
+extern char *mdvi_strncpy __PROTO((char *, const char *, size_t));
+extern char *mdvi_strdup __PROTO((const char *));
+extern char *mdvi_strndup __PROTO((const char *, size_t));
+extern void *mdvi_memdup __PROTO((const void *, size_t));
 
 /* macros to make memory allocation nicer */
-#define xalloc(t)      (t *)xmalloc(sizeof(t))
-#define xnalloc(t,n)   (t *)xcalloc((n), sizeof(t))
-#define xresize(p,t,n) (t *)xrealloc((p), (n) * sizeof(t))
+#define xalloc(t)      (t *)mdvi_malloc(sizeof(t))
+#define xnalloc(t,n)   (t *)mdvi_calloc((n), sizeof(t))
+#define xresize(p,t,n) (t *)mdvi_realloc((p), (n) * sizeof(t))
 
 extern char *xstradd __PROTO((char *, size_t *, size_t, const char *, size_t));
 
index 5dbacfbf01fb380ab954f27e2e8ed9faa4e2501f..06250cac6c8b036f66c4f39fe2b58f6ffab7fffb 100644 (file)
@@ -33,7 +33,7 @@ void  mdvi_push_color(DviContext *dvi, Ulong fg, Ulong bg)
 {
        if(dvi->color_top == dvi->color_size) {
                dvi->color_size += 32;
-               dvi->color_stack = xrealloc(dvi->color_stack,
+               dvi->color_stack = mdvi_realloc(dvi->color_stack,
                        dvi->color_size * sizeof(DviColorPair));
        }
        dvi->color_stack[dvi->color_top].fg = dvi->curr_fg;
index d4eddcc2eb2aade76e873cf63c9cfda506e3ac0e..8398c2702085521fa98195e239a19b83dac23485 100644 (file)
@@ -212,7 +212,7 @@ static int get_bytes(DviContext *dvi, size_t n)
                if(dvi->buffer.data == NULL) {
                        /* first allocation */
                        dvi->buffer.size = Max(DVI_BUFLEN, n);
-                       dvi->buffer.data = (Uchar *)xmalloc(dvi->buffer.size);
+                       dvi->buffer.data = (Uchar *)mdvi_malloc(dvi->buffer.size);
                        dvi->buffer.length = 0;
                        dvi->buffer.frozen = 0;
                } else if(dvi->buffer.pos < dvi->buffer.length) {
@@ -299,7 +299,7 @@ static long dtell(DviContext *dvi)
 static void dreset(DviContext *dvi)
 {
        if(!dvi->buffer.frozen && dvi->buffer.data)
-               xfree(dvi->buffer.data);
+               mdvi_free(dvi->buffer.data);
        dvi->buffer.data = NULL;
        dvi->buffer.size = 0;
        dvi->buffer.length = 0;
@@ -418,7 +418,7 @@ static DviFontRef *define_font(DviContext *dvi, int op)
        hdpi = FROUND(dvi->params.mag * dvi->params.dpi * scale / dsize);
        vdpi = FROUND(dvi->params.mag * dvi->params.vdpi * scale / dsize);
        n = duget1(dvi) + duget1(dvi);
-       name = xmalloc(n + 1);
+       name = mdvi_malloc(n + 1);
        dread(dvi, name, n);
        name[n] = 0;
        DEBUG((DBG_FONTS, "requesting font %d = `%s' at %.1fpt (%dx%d dpi)\n",
@@ -427,10 +427,10 @@ static DviFontRef *define_font(DviContext *dvi, int op)
        ref = font_reference(&dvi->params, arg, name, checksum, hdpi, vdpi, scale);
        if(ref == NULL) {
                error(_("could not load font `%s'\n"), name);
-               xfree(name);
+               mdvi_free(name);
                return NULL;
        }
-       xfree(name);
+       mdvi_free(name);
        return ref;
 }
 
@@ -444,11 +444,11 @@ static char *opendvi(const char *name)
        if(len >= 4 && STREQ(name+len-4, ".dvi")) {
                DEBUG((DBG_DVI|DBG_FILES, "opendvi: Trying `%s'\n", name));
                if(access(name, R_OK) == 0)
-                       return xstrdup(name);
+                       return mdvi_strdup(name);
        }
                
        /* try appending .dvi */
-       file = xmalloc(len + 5);
+       file = mdvi_malloc(len + 5);
        strcpy(file, name);
        strcpy(file+len, ".dvi");
        DEBUG((DBG_DVI|DBG_FILES, "opendvi: Trying `%s'\n", file));
@@ -459,7 +459,7 @@ static char *opendvi(const char *name)
        DEBUG((DBG_DVI|DBG_FILES, "opendvi: Trying `%s'\n", file));
        if(access(file, R_OK) == 0)
                return file;
-       xfree(file);
+       mdvi_free(file);
        return NULL;
 }
 
@@ -488,7 +488,7 @@ int mdvi_reload(DviContext *dvi, DviParams *np)
        font_drop_chain(dvi->fonts);
        /* destroy our font map */
        if(dvi->fontmap)
-               xfree(dvi->fontmap);
+               mdvi_free(dvi->fontmap);
        dvi->currfont = NULL;
 
        /* and use the ones we just loaded */
@@ -505,27 +505,27 @@ int       mdvi_reload(DviContext *dvi, DviParams *np)
        dvi->dvivconv = newdvi->dvivconv;
        dvi->modtime = newdvi->modtime;
 
-       if(dvi->fileid) xfree(dvi->fileid);
+       if(dvi->fileid) mdvi_free(dvi->fileid);
        dvi->fileid = newdvi->fileid;
                
        dvi->dvi_page_w = newdvi->dvi_page_w;
        dvi->dvi_page_h = newdvi->dvi_page_h;
 
-       xfree(dvi->pagemap);
+       mdvi_free(dvi->pagemap);
        dvi->pagemap = newdvi->pagemap;
        dvi->npages = newdvi->npages;
        if(dvi->currpage > dvi->npages-1)
                dvi->currpage = 0;
                
-       xfree(dvi->stack);
+       mdvi_free(dvi->stack);
        dvi->stack = newdvi->stack;
        dvi->stacksize = newdvi->stacksize;
 
        /* remove fonts that are not being used anymore */
        font_free_unused(&dvi->device);
                
-       xfree(newdvi->filename);                
-       xfree(newdvi);
+       mdvi_free(newdvi->filename);            
+       mdvi_free(newdvi);
 
        DEBUG((DBG_DVI, "%s: reload successful\n", dvi->filename));
        if(dvi->device.refresh)
@@ -686,7 +686,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
        p = fopen(filename, "r");
        if(p == NULL) {
                perror(file);
-               xfree(filename);
+               mdvi_free(filename);
                return NULL;
        }
        dvi = xalloc(DviContext);
@@ -759,7 +759,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
 
        /* get the comment from the preamble */
        n = fuget1(p);
-       dvi->fileid = xmalloc(n + 1);
+       dvi->fileid = mdvi_malloc(n + 1);
        fread(dvi->fileid, 1, n, p);
        dvi->fileid[n] = 0;
        DEBUG((DBG_DVI, "%s: %s\n", filename, dvi->fileid));
@@ -918,23 +918,23 @@ void      mdvi_destroy_context(DviContext *dvi)
                font_free_unused(&dvi->device);
        }
        if(dvi->fontmap)
-               xfree(dvi->fontmap);
+               mdvi_free(dvi->fontmap);
        if(dvi->filename)
-               xfree(dvi->filename);
+               mdvi_free(dvi->filename);
        if(dvi->stack)
-               xfree(dvi->stack);
+               mdvi_free(dvi->stack);
        if(dvi->pagemap)
-               xfree(dvi->pagemap);
+               mdvi_free(dvi->pagemap);
        if(dvi->fileid)
-               xfree(dvi->fileid);
+               mdvi_free(dvi->fileid);
        if(dvi->in)
                fclose(dvi->in);
        if(dvi->buffer.data && !dvi->buffer.frozen)
-               xfree(dvi->buffer.data);
+               mdvi_free(dvi->buffer.data);
        if(dvi->color_stack)
-               xfree(dvi->color_stack);
+               mdvi_free(dvi->color_stack);
        
-       xfree(dvi);
+       mdvi_free(dvi);
 }
 
 void   mdvi_setpage(DviContext *dvi, int pageno)
@@ -1049,7 +1049,7 @@ again:
        dvi->curr_layer = 0;
        
        if(dvi->buffer.data && !dvi->buffer.frozen)
-               xfree(dvi->buffer.data);
+               mdvi_free(dvi->buffer.data);
 
        /* reset our buffer */
        dvi->buffer.data   = NULL;
@@ -1536,13 +1536,13 @@ int     special(DviContext *dvi, int opcode)
        Int32   arg;
        
        arg = dugetn(dvi, opcode - DVI_XXX1 + 1);
-       s = xmalloc(arg + 1);
+       s = mdvi_malloc(arg + 1);
        dread(dvi, s, arg);
        s[arg] = 0;
        mdvi_do_special(dvi, s);
        SHOWCMD((dvi, "XXXX", opcode - DVI_XXX1 + 1,
                "[%s]", s));
-       xfree(s);
+       mdvi_free(s);
        return 0;
 }
 
index 265b081e33006a61cea34761e5f4449a88e33cb9..ca3436c5ee8f368aab1cc819100beb6af0c29269 100644 (file)
@@ -74,7 +74,7 @@ void  font_drop_one(DviFontRef *ref)
        DviFont *font;
        
        font = ref->ref;
-       xfree(ref);
+       mdvi_free(ref);
        /* drop all children */
        for(ref = font->subfonts; ref; ref = ref->next) {
                /* just adjust the reference counts */
@@ -131,7 +131,7 @@ int font_free_unused(DviDevice *dev)
                /* get rid of subfonts (but can't use `drop_chain' here) */
                for(; (ref = font->subfonts); ) {
                        font->subfonts = ref->next;
-                       xfree(ref);
+                       mdvi_free(ref);
                }
                /* remove this font */
                font_reset_font_glyphs(dev, font, MDVI_FONTSEL_GLYPH);
@@ -140,10 +140,10 @@ int       font_free_unused(DviDevice *dev)
                        font->finfo->freedata(font);
                /* destroy characters */
                if(font->chars)
-                       xfree(font->chars);
-               xfree(font->fontname);
-               xfree(font->filename);
-               xfree(font);
+                       mdvi_free(font->chars);
+               mdvi_free(font->fontname);
+               mdvi_free(font->filename);
+               mdvi_free(font);
        }
        DEBUG((DBG_FONTS, "%d unused fonts removed\n", count));
        return count;
index 26b33afcfdcfbe7f79917114def911c07805a67e..cc610643633556ee8c8300d0d00a1da73ccf42cc 100644 (file)
@@ -136,14 +136,14 @@ static int read_encoding(DviEncoding *enc)
        /* setup the hash table */
        mdvi_hash_create(&enc->nametab, ENCNAME_HASH_SIZE);
        /* setup the encoding vector */
-       enc->vector = (char **)xmalloc(256 * sizeof(char *));
+       enc->vector = (char **)mdvi_malloc(256 * sizeof(char *));
 
        /* jump to the beginning of the interesting part */
        fseek(in, enc->offset, SEEK_SET);
        /* and read everything */
        if(fread(enc->private, st.st_size, 1, in) != 1) {
                fclose(in);
-               xfree(enc->private);
+               mdvi_free(enc->private);
                enc->private = NULL;
                return -1;
        }
@@ -188,8 +188,8 @@ static int read_encoding(DviEncoding *enc)
        }
        if(curr == 0) {
                mdvi_hash_reset(&enc->nametab, 0);
-               xfree(enc->private);
-               xfree(enc);
+               mdvi_free(enc->private);
+               mdvi_free(enc);
                return -1;
        }
        while(curr < 256)
@@ -213,21 +213,21 @@ static void destroy_encoding(DviEncoding *enc)
        if(enc != tex_text_encoding) {
                mdvi_hash_reset(&enc->nametab, 0);
                if(enc->private) {
-                       xfree(enc->private);
-                       xfree(enc->vector);
+                       mdvi_free(enc->private);
+                       mdvi_free(enc->vector);
                }
                if(enc->name)
-                       xfree(enc->name);
+                       mdvi_free(enc->name);
                if(enc->filename)
-                       xfree(enc->filename);
-               xfree(enc);
+                       mdvi_free(enc->filename);
+               mdvi_free(enc);
        }
 }
 
 /* this is used for the `enctable_file' hash table */
 static void file_hash_free(DviHashKey key, void *data)
 {
-       xfree(key);
+       mdvi_free(key);
 }
 
 static DviEncoding *register_encoding(const char *basefile, int replace)
@@ -264,11 +264,11 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
 
        /* finally try the given name */
        if(filename == NULL)
-               filename = xstrdup(basefile);
+               filename = mdvi_strdup(basefile);
 
        in = fopen(filename, "r");
        if(in == NULL) {
-               xfree(filename);
+               mdvi_free(filename);
                return NULL;
        }
        
@@ -299,7 +299,7 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
                DEBUG((DBG_FMAP, 
                        "%s: could not determine name of encoding\n",
                        basefile));
-               xfree(filename);
+               mdvi_free(filename);
                return NULL;
        }
        
@@ -315,7 +315,7 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
        } else if(enc) {
                /* if the encoding is being used, refuse to remove it */
                if(enc->links) {
-                       xfree(filename);
+                       mdvi_free(filename);
                        dstring_reset(&input);
                        return NULL;
                }
@@ -330,13 +330,13 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
                        DEBUG((DBG_FMAP, "%s: overriding encoding\n", name));
                        destroy_encoding(enc);
                } else {
-                       xfree(filename);
+                       mdvi_free(filename);
                        dstring_reset(&input);
                        return enc; /* no error */
                }
        }
        enc = xalloc(DviEncoding);
-       enc->name = xstrdup(name);
+       enc->name = mdvi_strdup(name);
        enc->filename = filename;
        enc->links = 0;
        enc->offset = offset;
@@ -348,7 +348,7 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
                default_encoding = enc;
        mdvi_hash_add(&enctable, MDVI_KEY(enc->name), 
                enc, MDVI_HASH_UNCHECKED);
-       mdvi_hash_add(&enctable_file, MDVI_KEY(xstrdup(basefile)), 
+       mdvi_hash_add(&enctable_file, MDVI_KEY(mdvi_strdup(basefile)), 
                enc, MDVI_HASH_REPLACE);
        listh_prepend(&encodings, LIST(enc));
        DEBUG((DBG_FMAP, "%s: encoding `%s' registered\n",
@@ -441,8 +441,8 @@ static void parse_spec(DviFontMapEnt *ent, char *spec)
                        ent->extend = SFROUND(x);
                } else if(STREQ(command, "ReEncodeFont")) {
                        if(ent->encoding)
-                               xfree(ent->encoding);
-                       ent->encoding = xstrdup(arg);
+                               mdvi_free(ent->encoding);
+                       ent->encoding = mdvi_strdup(arg);
                }
        }
 }
@@ -480,7 +480,7 @@ DviFontMapEnt       *mdvi_load_fontmap(const char *file)
                in = fopen(file, "r");                  
        else {
                in = fopen(ptr, "r");
-               xfree(ptr);
+               mdvi_free(ptr);
        }
        if(in == NULL)
                return NULL;
@@ -566,10 +566,10 @@ DviFontMapEnt     *mdvi_load_fontmap(const char *file)
 
                if(tex_name == NULL)
                        continue;
-               ent->fontname = xstrdup(tex_name);
-               ent->psname   = ps_name   ? xstrdup(ps_name)   : NULL;
-               ent->fontfile = font_file ? xstrdup(font_file) : NULL;
-               ent->encfile  = vec_name  ? xstrdup(vec_name)  : NULL;
+               ent->fontname = mdvi_strdup(tex_name);
+               ent->psname   = ps_name   ? mdvi_strdup(ps_name)   : NULL;
+               ent->fontfile = font_file ? mdvi_strdup(font_file) : NULL;
+               ent->encfile  = vec_name  ? mdvi_strdup(vec_name)  : NULL;
                ent->fullfile = NULL;
                enc = NULL; /* we don't have this yet */
 
@@ -589,7 +589,7 @@ DviFontMapEnt       *mdvi_load_fontmap(const char *file)
        _("%s: %d: [%s] requested encoding `%s' does not match vector `%s'\n"),
                                        file, lineno);
                        } else if(!ent->encoding)
-                               ent->encoding = xstrdup(enc->name);
+                               ent->encoding = mdvi_strdup(enc->name);
                }
                
                /* add it to the list */
@@ -606,18 +606,18 @@ DviFontMapEnt     *mdvi_load_fontmap(const char *file)
 static void free_ent(DviFontMapEnt *ent)
 {
        ASSERT(ent->fontname != NULL);
-       xfree(ent->fontname);
+       mdvi_free(ent->fontname);
        if(ent->psname)
-               xfree(ent->psname);
+               mdvi_free(ent->psname);
        if(ent->fontfile)
-               xfree(ent->fontfile);
+               mdvi_free(ent->fontfile);
        if(ent->encoding)
-               xfree(ent->encoding);
+               mdvi_free(ent->encoding);
        if(ent->encfile)
-               xfree(ent->encfile);
+               mdvi_free(ent->encfile);
        if(ent->fullfile)
-               xfree(ent->fullfile);
-       xfree(ent);
+               mdvi_free(ent->fullfile);
+       mdvi_free(ent);
 }
 
 void   mdvi_install_fontmap(DviFontMapEnt *head)
@@ -729,7 +729,7 @@ static int  mdvi_init_fontmaps(void)
                in = fopen(config, "r");
        else {
                in = fopen(file, "r");
-               xfree(file);
+               mdvi_free(file);
        }
        if(in == NULL)
                return -1;
@@ -768,14 +768,14 @@ static int        mdvi_init_fontmaps(void)
                        if(!psinitialized)
                                ps_init_default_paths();
                        if(psfontdir)
-                               xfree(psfontdir);
+                               mdvi_free(psfontdir);
                        psfontdir = kpse_path_expand(arg);
                } else if(STRNEQ(line, "pslibpath", 9)) {
                        arg = getstring(line + 10, " \t", &line); *line = 0;
                        if(!psinitialized)
                                ps_init_default_paths();
                        if(pslibdir)
-                               xfree(pslibdir);
+                               mdvi_free(pslibdir);
                        pslibdir = kpse_path_expand(arg);
                } else if(STRNEQ(line, "psfontmap", 9)) {
                        arg = getstring(line + 9, " \t", &line); *line = 0;
@@ -822,8 +822,8 @@ int mdvi_add_fontmap_file(const char *name, const char *fullpath)
        if(ent == NULL)
                return -1;
        if(ent->fullfile)
-               xfree(ent->fullfile);
-       ent->fullfile = xstrdup(fullpath);
+               mdvi_free(ent->fullfile);
+       ent->fullfile = mdvi_strdup(fullpath);
        return 0;
 }
 
@@ -907,7 +907,7 @@ int mdvi_ps_read_fontmap(const char *name)
        in = fopen(fullname, "r");
        if(in == NULL) {
                if(fullname != name)
-                       xfree(fullname);
+                       mdvi_free(fullname);
                return -1;
        }
        dstring_init(&dstr);
@@ -956,18 +956,18 @@ int       mdvi_ps_read_fontmap(const char *name)
                        DEBUG((DBG_FMAP, 
                                "(ps) replacing font `%s' (%s) by `%s'\n",
                                name, ps->mapname, mapname));
-                       xfree(ps->mapname);
-                       ps->mapname = xstrdup(mapname);
+                       mdvi_free(ps->mapname);
+                       ps->mapname = mdvi_strdup(mapname);
                        if(ps->fullname) {
-                               xfree(ps->fullname);
+                               mdvi_free(ps->fullname);
                                ps->fullname = NULL;
                        }
                } else {
                        DEBUG((DBG_FMAP, "(ps) adding font `%s' as `%s'\n",
                                name, mapname));
                        ps = xalloc(PSFontMap);
-                       ps->psname   = xstrdup(name);
-                       ps->mapname  = xstrdup(mapname);
+                       ps->psname   = mdvi_strdup(name);
+                       ps->mapname  = mdvi_strdup(mapname);
                        ps->fullname = NULL;
                        listh_append(&psfonts, LIST(ps));
                        mdvi_hash_add(&pstable, MDVI_KEY(ps->psname),
@@ -994,19 +994,19 @@ void      mdvi_ps_flush_fonts(void)
        mdvi_hash_reset(&pstable, 0);
        for(; (map = (PSFontMap *)psfonts.head); ) {
                psfonts.head = LIST(map->next);
-               xfree(map->psname);
-               xfree(map->mapname);
+               mdvi_free(map->psname);
+               mdvi_free(map->mapname);
                if(map->fullname)
-                       xfree(map->fullname);
-               xfree(map);
+                       mdvi_free(map->fullname);
+               mdvi_free(map);
        }
        listh_init(&psfonts);
        if(pslibdir) {
-               xfree(pslibdir);
+               mdvi_free(pslibdir);
                pslibdir = NULL;
        }
        if(psfontdir) {
-               xfree(psfontdir);
+               mdvi_free(psfontdir);
                psfontdir = NULL;
        }
        psinitialized = 0;
@@ -1025,7 +1025,7 @@ char      *mdvi_ps_find_font(const char *psname)
        if(map == NULL)
                return NULL;
        if(map->fullname)
-               return xstrdup(map->fullname);
+               return mdvi_strdup(map->fullname);
 
        /* is it an alias? */
        smap = map;
@@ -1043,11 +1043,11 @@ char    *mdvi_ps_find_font(const char *psname)
        if(psfontdir)
                filename = kpse_path_search(psfontdir, smap->mapname, 1);
        else if(file_exists(map->mapname))
-               filename = xstrdup(map->mapname);
+               filename = mdvi_strdup(map->mapname);
        else
                filename = NULL;
        if(filename)
-               map->fullname = xstrdup(filename);
+               map->fullname = mdvi_strdup(filename);
                
        return filename;
 }
@@ -1113,21 +1113,21 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname)
        if(baselen + 4 < 64)
                afmfile = &buffer[0];
        else
-               afmfile = xmalloc(baselen + 5);
+               afmfile = mdvi_malloc(baselen + 5);
        strcpy(afmfile, basefile);
        strcpy(afmfile + baselen, ".afm");
        /* we don't need this anymore */
-       xfree(psfont);
+       mdvi_free(psfont);
        DEBUG((DBG_FMAP, "(ps) %s: looking for `%s'\n",
                fontname, afmfile));
        /* lookup the file */
        psfont = kpse_path_search(psfontdir, afmfile, 1);
        /* don't need this anymore */
        if(afmfile != &buffer[0])
-               xfree(afmfile);
+               mdvi_free(afmfile);
        if(psfont != NULL) {
                info = get_font_metrics(fontname, DviFontAFM, psfont);
-               xfree(psfont);
+               mdvi_free(psfont);
        } else
                info = NULL;
        if(info == NULL || (!map.extend && !map.slant))
index feeeac98382304680a8a9916af0ce7d03efa2764..415ed9157799c2f9303e4f672543b3a0866e09b4 100644 (file)
@@ -96,7 +96,7 @@ char  **mdvi_list_font_class(int klass)
        list = xnalloc(char *, n + 1);
        fc = (DviFontClass *)font_classes[klass].head;
        for(i = 0; i < n; fc = fc->next, i++) {
-               list[i] = xstrdup(fc->info.name);
+               list[i] = mdvi_strdup(fc->info.name);
        }
        list[i] = NULL;
        return list;
@@ -115,7 +115,7 @@ int mdvi_register_font_type(DviFontInfo *info, int klass)
        fc = xalloc(struct _DviFontClass);
        fc->links = 0;
        fc->id = klass;
-       fc->info.name = xstrdup(info->name);
+       fc->info.name = mdvi_strdup(info->name);
        fc->info.scalable = info->scalable;
        fc->info.load = info->load;
        fc->info.getglyph = info->getglyph;
@@ -160,8 +160,8 @@ int mdvi_unregister_font_type(const char *name, int klass)
        listh_remove(&font_classes[k], LIST(fc));
        
        /* and destroy it */
-       xfree(fc->info.name);
-       xfree(fc);
+       mdvi_free(fc->info.name);
+       mdvi_free(fc);
        return 0;
 }
 
@@ -182,7 +182,7 @@ static char *lookup_font(DviFontClass *ptr, const char *name, Ushort *h, Ushort
                        ptr->info.kpse_type, &type);
                /* if kpathsea returned a fallback font, reject it */
                if(filename && type.source == kpse_glyph_source_fallback) {
-                       xfree(filename);
+                       mdvi_free(filename);
                        filename = NULL;
                } else if(filename)
                        *h = *v = type.dpi;
@@ -323,13 +323,13 @@ DviFont   *mdvi_add_font(const char *name, Int32 sum,
        DviFont *font;
        
        font = xalloc(DviFont);
-       font->fontname = xstrdup(name);
+       font->fontname = mdvi_strdup(name);
        SEARCH_INIT(font->search, font->fontname, hdpi, vdpi);
        font->filename = mdvi_lookup_font(&font->search);
        if(font->filename == NULL) {
                /* this answer is final */
-               xfree(font->fontname);
-               xfree(font);
+               mdvi_free(font->fontname);
+               mdvi_free(font);
                return NULL;
        }
        font->hdpi = font->search.actual_hdpi;
@@ -360,7 +360,7 @@ int mdvi_font_retry(DviParams *params, DviFont *font)
        filename = mdvi_lookup_font(&font->search);
        if(filename == NULL)
                return -1;
-       xfree(font->filename);
+       mdvi_free(font->filename);
        font->filename = filename;
        /* copy the new information */
        font->hdpi = font->search.actual_hdpi;
index 459e428eced295333f53847b0c6274c401fd085d..2c147ec666648d2c649f3f75cda877a945eb058c 100644 (file)
@@ -191,7 +191,7 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch)
                                s = read_string(p, op - GF_XXX1 + 1, NULL, 0);
                                DEBUG((DBG_SPECIAL, "(gf) Character %d: Special \"%s\"\n",
                                        ch->code, s));
-                               xfree(s);
+                               mdvi_free(s);
 #else
                                n = fugetn(p, op - GF_XXX1 + 1);
                                fseek(p, (long)n, SEEK_CUR);
@@ -362,7 +362,7 @@ badgf:
        error(_("%s: File corrupted, or not a GF file\n"), font->fontname);
 error:
        if(font->chars) {
-               xfree(font->chars);
+               mdvi_free(font->chars);
                font->chars = NULL;
        }
        font->loc = font->hic = 0;
index 5487bed59df9392374810476abcc26ce040f74ac..d030650a0be7379f23eadbf6d400109b90bcdf5d 100644 (file)
@@ -156,7 +156,7 @@ void        *mdvi_hash_remove(DviHashTable *hash, DviHashKey key)
 
        if(buck) {
                data = buck->data;
-               xfree(buck);
+               mdvi_free(buck);
        }
        return data;
 }
@@ -184,7 +184,7 @@ void        *mdvi_hash_remove_ptr(DviHashTable *hash, DviHashKey key)
        hash->nkeys--;
        /* destroy the bucket */
        ptr = buck->data;
-       xfree(buck);
+       mdvi_free(buck);
        return ptr;
 }
 
@@ -196,7 +196,7 @@ int mdvi_hash_destroy_key(DviHashTable *hash, DviHashKey key)
                return -1;
        if(hash->hash_free)
                hash->hash_free(buck->key, buck->data);
-       xfree(buck);
+       mdvi_free(buck);
        return 0;       
 }
 
@@ -211,12 +211,12 @@ void      mdvi_hash_reset(DviHashTable *hash, int reuse)
                        hash->buckets[i] = buck->next;
                        if(hash->hash_free)
                                hash->hash_free(buck->key, buck->data);
-                       xfree(buck);
+                       mdvi_free(buck);
                }
        }
        hash->nkeys = 0;
        if(!reuse && hash->buckets) {
-               xfree(hash->buckets);
+               mdvi_free(hash->buckets);
                hash->buckets = NULL;
                hash->nbucks = 0;
        } /* otherwise, it is left empty, ready to be reused */
index 7fc610a4686e0e15f2541a5d7bb7da62b5fb2476..b24157c4635923a45fa08e55720a77c9d7ea5261 100644 (file)
@@ -53,7 +53,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha
        size  = 0;
        curr  = 0;
        range = NULL;
-       copy  = xstrdup(format);
+       copy  = mdvi_strdup(format);
        done  = 0;
        lower = 0;
        upper = 0;
@@ -167,7 +167,7 @@ finish:
                
                if(curr == size) {
                        size += 8;
-                       range = xrealloc(range, size * sizeof(DviRange));
+                       range = mdvi_realloc(range, size * sizeof(DviRange));
                }
                memcpy(&range[curr++], &one, sizeof(DviRange));
                *cp = ch;
@@ -180,9 +180,9 @@ finish:
        if(endptr)
                *endptr = (char *)format + (cp - copy);
        if(curr && curr < size)
-               range = xrealloc(range, curr * sizeof(DviRange));
+               range = mdvi_realloc(range, curr * sizeof(DviRange));
        *nitems = curr;
-       xfree(copy);
+       mdvi_free(copy);
        return range;
 }
 
@@ -207,7 +207,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format)
        if(*format != '*') {
                range = mdvi_parse_range(format, NULL, &count, &ptr);
                if(ptr == format) {
-                       if(range) xfree(range);
+                       if(range) mdvi_free(range);
                        error(_("invalid page specification `%s'\n"), format);
                        return NULL;
                }
@@ -242,7 +242,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format)
                        
                        range = mdvi_parse_range(ptr, NULL, &count, &end);
                        if(end == ptr) {
-                               if(range) xfree(range);
+                               if(range) mdvi_free(range);
                                range = NULL;
                        } else
                                ptr = end;
@@ -294,10 +294,10 @@ void      mdvi_free_page_spec(DviPageSpec *spec)
        
        for(i = 0; i < 11; i++)
                if(spec[i]) {
-                       xfree(spec[i]->ranges);
-                       xfree(spec[i]);
+                       mdvi_free(spec[i]->ranges);
+                       mdvi_free(spec[i]);
                }
-       xfree(spec);
+       mdvi_free(spec);
 }
 
 int    mdvi_in_range(DviRange *range, int nitems, int value)
@@ -449,7 +449,7 @@ int main()
                        }
                }
 #endif
-               if(range) xfree(range);
+               if(range) mdvi_free(range);
        }
 #else
        DviPageSpec *spec;
index b98f5e09d7d7e209ab0b6202920482f5fb3d90b2..7a7412d2b617f4ba8b65199e09fe116f3458f9cb 100644 (file)
@@ -166,5 +166,5 @@ DviPaperSpec *mdvi_get_paper_specs(DviPaperClass pclass)
 
 void   mdvi_free_paper_specs(DviPaperSpec *spec)
 {
-       xfree(spec);
+       mdvi_free(spec);
 }
index 7c1d13a29e4eb9199a9f892bb13ada5523804b95..48da0084445f5aad64c5a95274a6f4c197e8f87d 100644 (file)
@@ -106,7 +106,7 @@ static char *pk_lookup(const char *name, Ushort *hdpi, Ushort *vdpi)
        filename = kpse_find_glyph(name, Max(*hdpi, *vdpi),
                kpse_pk_format, &type);
        if(filename && type.source == kpse_glyph_source_fallback) {
-               xfree(filename);
+               mdvi_free(filename);
                filename = NULL;
        } else if(filename) {
                *hdpi = *vdpi = type.dpi;
@@ -126,7 +126,7 @@ static char *pk_lookupn(const char *name, Ushort *hdpi, Ushort *vdpi)
        filename = kpse_find_glyph(name, Max(*hdpi, *vdpi),
                kpse_pk_format, &type);
        if(filename && type.source == kpse_glyph_source_fallback) {
-               xfree(filename);
+               mdvi_free(filename);
                filename = NULL;
        } else if(filename) {
                *hdpi = *vdpi = type.dpi;
@@ -392,14 +392,14 @@ static int pk_load_font(DviParams *unused, DviFont *font)
                                if(i < 256)
                                        t = &s[0];
                                else
-                                       t = xmalloc(i + 1);
+                                       t = mdvi_malloc(i + 1);
                                for(n = 0; n < i; n++)
                                        t[n] = fuget1(p);
                                t[n] = 0;
                                DEBUG((DBG_SPECIAL, "(pk) %s: Special \"%s\"\n",
                                        font->fontname, t));
                                if(t != &s[0])
-                                       xfree(t);
+                                       mdvi_free(t);
 #else
                                i = fugetn(p, flag_byte - PK_X1 + 1);
                                while(i-- > 0)
@@ -524,7 +524,7 @@ static int pk_load_font(DviParams *unused, DviFont *font)
 badpk:
        error(_("%s: File corrupted, or not a PK file\n"), font->fontname);
 error:
-       xfree(font->chars);
+       mdvi_free(font->chars);
        font->chars = NULL;
        font->loc = font->hic = 0;
        return -1;
index 9a07fc7923687648e7e11572f867d450a91df375..ca13c8645d80e077f89cd63b42df2d5c68d8bded 100644 (file)
@@ -242,7 +242,7 @@ void        epsf_special(DviContext *dvi, char *prefix, char *arg)
        
        file = parse_epsf_special(&box, &special, prefix, arg);
        if(file != NULL)
-               xfree(special);
+               mdvi_free(special);
        /* 
         * draw the bounding box. Notice that it is in PostScript units,
         * so we have to convert it into pixels
index 7188bd8ed5480b9bf796e5dc34cea6639cfff839..23c070e16fe79c3f2ee8584e659daa05a56114b5 100644 (file)
@@ -99,12 +99,12 @@ int mdvi_register_special(const char *label, const char *prefix,
        sp = find_special_prefix(prefix);
        if(sp == NULL) {
                sp = xalloc(DviSpecial);
-               sp->prefix = xstrdup(prefix);
+               sp->prefix = mdvi_strdup(prefix);
                newsp = 1;
        } else if(!replace)
                return -1;
        else {
-               xfree(sp->label);
+               mdvi_free(sp->label);
                sp->label = NULL;
        }
 
@@ -115,15 +115,15 @@ int       mdvi_register_special(const char *label, const char *prefix,
        }
        if(regex && regcomp(&sp->reg, regex, REG_NOSUB) != 0) {
                if(newsp) {
-                       xfree(sp->prefix);
-                       xfree(sp);
+                       mdvi_free(sp->prefix);
+                       mdvi_free(sp);
                }
                return -1;
        }
        sp->has_reg = (regex != NULL);
 #endif
        sp->handler = handler;
-       sp->label = xstrdup(label);
+       sp->label = mdvi_strdup(label);
        sp->plen = strlen(prefix);
        if(newsp)
                listh_prepend(&specials, LIST(sp));             
@@ -140,13 +140,13 @@ int       mdvi_unregister_special(const char *prefix)
        sp = find_special_prefix(prefix);       
        if(sp == NULL)
                return -1;
-       xfree(sp->prefix);
+       mdvi_free(sp->prefix);
 #ifdef WITH_REGEX_SPECIALS
        if(sp->has_reg)
                regfree(&sp->reg);
 #endif
        listh_remove(&specials, LIST(sp));
-       xfree(sp);
+       mdvi_free(sp);
        return 0;
 }
 
@@ -216,13 +216,13 @@ void      mdvi_flush_specials(void)
        
        for(list = (DviSpecial *)specials.head; (sp = list); ) {
                list = sp->next;
-               if(sp->prefix) xfree(sp->prefix);
-               if(sp->label) xfree(sp->label);
+               if(sp->prefix) mdvi_free(sp->prefix);
+               if(sp->label) mdvi_free(sp->label);
 #ifdef WITH_REGEX_SPECIALS
                if(sp->has_reg)
                        regfree(&sp->reg);
 #endif
-               xfree(sp);
+               mdvi_free(sp);
        }
        specials.head = NULL;
        specials.tail = NULL;
index bc2900b2049e6ce05126d3f48e3cebf43f056537..f88db4b35036451c999f4a4bb32de9b8c03a7b20 100644 (file)
@@ -123,7 +123,7 @@ char        *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi)
                DEBUG((DBG_TYPE1, "(t1) %s: found `%s' (cached)\n",
                        name, info.fullfile));
                /* this is a cached lookup */
-               return xstrdup(info.fullfile);
+               return mdvi_strdup(info.fullfile);
        }
        
        /* no file associated to this font? */
@@ -142,7 +142,7 @@ char        *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi)
 
        /* get the `base' name */
        if(ext) {
-               newname = xstrdup(name);
+               newname = mdvi_strdup(name);
                newname[ext - info.fontfile - 1] = 0;
        } else
                newname = (char *)name; /* we don't modify this */
@@ -154,7 +154,7 @@ char        *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi)
 
        /* we don't need this anymore */
        if(newname != name)
-               xfree(newname);
+               mdvi_free(newname);
        if(filename == NULL) {
                DEBUG((DBG_TYPE1, "(t1) %s: not found\n", name));
                return NULL;
@@ -312,7 +312,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info)
        i = info->tfminfo->hic - info->tfminfo->loc + 1;
        if(i != font->hic - font->loc + 1) {
                /* reset to optimal size */
-               font->chars = xrealloc(font->chars, i * sizeof(DviFontChar));
+               font->chars = mdvi_realloc(font->chars, i * sizeof(DviFontChar));
        }
 
        /* get the scaled characters metrics */
@@ -330,7 +330,7 @@ t1_error:
        /* first destroy the private data */
        t1_font_remove(info);
        /* now reset all chars -- this is the important part */
-       xfree(font->chars);
+       mdvi_free(font->chars);
        font->chars = NULL;
        font->loc = font->hic = 0;
        return -1;
@@ -598,8 +598,8 @@ static void t1_font_remove(T1Info *info)
 
        if(info->tfminfo)
                free_font_metrics(info->tfminfo);
-       /*xfree(info->fontname);*/
-       xfree(info);
+       /*mdvi_free(info->fontname);*/
+       mdvi_free(info);
 }
 
 static void t1_free_data(DviFont *font)
index 6cc82abf1d72bdd333c5daf3066db6051a5694e5..3779c6b4a03ab222f0cb1f9c360e5125364509f4 100644 (file)
@@ -93,7 +93,7 @@ int   get_tfm_chars(DviParams *params, DviFont *font, TFMInfo *info, int loaded)
        
        n = info->hic - info->loc + 1;
        if(n != FONT_GLYPH_COUNT(font)) {
-               font->chars = xrealloc(font->chars,
+               font->chars = mdvi_realloc(font->chars,
                        n * sizeof(DviFontChar));
        }
        font->loc = info->loc;
index 913cd0e7ea1ad13c466844eea5edca04eb3796ce..1ea1b1382457612f750fe61fdef5bbbbd5343452 100644 (file)
@@ -98,8 +98,8 @@ int   afm_load_file(const char *filename, TFMInfo *info)
        info->design = 0xa00000; /* fake -- 10pt */
        info->checksum = 0; /* no checksum */
        info->type = DviFontAFM;
-       xstrncpy(info->coding, fi->gfi->encodingScheme, 63);
-       xstrncpy(info->family, fi->gfi->familyName, 63);
+       mdvi_strncpy(info->coding, fi->gfi->encodingScheme, 63);
+       mdvi_strncpy(info->family, fi->gfi->familyName, 63);
 
        /* now get the data */
        for(cm = fi->cmi; cm < fi->cmi + fi->numOfChars; cm++) {
@@ -135,7 +135,7 @@ int afm_load_file(const char *filename, TFMInfo *info)
                memmove(&info->chars[0],
                        &info->chars[info->loc],
                        (info->hic - info->loc + 1) * sizeof(TFMChar));
-               info->chars = xrealloc(info->chars,
+               info->chars = mdvi_realloc(info->chars,
                        (info->hic - info->loc + 1) * sizeof(TFMChar));
        }
 
@@ -179,7 +179,7 @@ int tfm_load_file(const char *filename, TFMInfo *info)
        if(size != st.st_size)
                warning(_("Warning: TFM file `%s' has suspicious size\n"), 
                        filename);
-       tfm = (Uchar *)xmalloc(size);
+       tfm = (Uchar *)mdvi_malloc(size);
        if(fread(tfm, st.st_size, 1, in) != 1)
                goto error;
        /* we don't need this anymore */
@@ -282,14 +282,14 @@ int       tfm_load_file(const char *filename, TFMInfo *info)
        }
 
        /* free everything */
-       xfree(tfm);
+       mdvi_free(tfm);
        
        return 0;
 
 bad_tfm:
        error(_("%s: File corrupted, or not a TFM file\n"), filename);
 error:
-       if(tfm) xfree(tfm);
+       if(tfm) mdvi_free(tfm);
        if(in)  fclose(in);
        return -1;      
 }
@@ -391,7 +391,7 @@ static int ofm1_load_file(FILE *in, TFMInfo *info)
        tfm = xnalloc(Int32, size);
        /* read them in one sweep */
        if(fread(tfm, 4, size, in) != size) {
-               xfree(tfm);
+               mdvi_free(tfm);
                goto bad_tfm;
        }
 
@@ -418,11 +418,11 @@ static int ofm1_load_file(FILE *in, TFMInfo *info)
        }
 
        /* NOW we're done */
-       xfree(tfm);
+       mdvi_free(tfm);
        return 0;
 
 bad_tfm:
-       if(tfm) xfree(tfm);
+       if(tfm) mdvi_free(tfm);
        return -1;
 }
 
@@ -533,7 +533,7 @@ static int  ofm_load_file(const char *filename, TFMInfo *info)
        size = 2*(ec - bc + 1) + nw + nh + nd;
        tfm = xnalloc(Int32, size * sizeof(Int32));
        if(fread(tfm, 4, size, in) != size) {
-               xfree(tfm);
+               mdvi_free(tfm);
                goto bad_tfm;
        }
        /* byte-swap all the tables at once */
@@ -547,7 +547,7 @@ static int  ofm_load_file(const char *filename, TFMInfo *info)
        depths   = cb;
 
        if(widths[0] || heights[0] || depths[0]) {
-               xfree(tfm);
+               mdvi_free(tfm);
                goto bad_tfm;
        }
 
@@ -582,7 +582,7 @@ static int  ofm_load_file(const char *filename, TFMInfo *info)
                info->chars[i-bc].depth = depths[ndx];
        }
 
-       xfree(tfm);
+       mdvi_free(tfm);
        return 0;
 
 bad_tfm:
@@ -686,12 +686,12 @@ TFMInfo   *get_font_metrics(const char *short_name, int type, const char *filename
                break;
        }
        if(file != filename)
-               xfree(file);
+               mdvi_free(file);
        if(status < 0) {
-               xfree(tfm);
+               mdvi_free(tfm);
                return NULL;
        }
-       tfm->short_name = xstrdup(short_name);
+       tfm->short_name = mdvi_strdup(short_name);
        
        /* add it to the pool */
        if(tfmpool.count == 0)
@@ -726,9 +726,9 @@ void        free_font_metrics(TFMInfo *info)
 
        DEBUG((DBG_FONTS, "(mt) removing unused TFM data for `%s'\n", tfm->short_name));
        listh_remove(&tfmpool, LIST(tfm));
-       xfree(tfm->short_name);
-       xfree(tfm->tfminfo.chars);
-       xfree(tfm);     
+       mdvi_free(tfm->short_name);
+       mdvi_free(tfm->tfminfo.chars);
+       mdvi_free(tfm); 
 }
 
 void   flush_font_metrics(void)
@@ -738,9 +738,9 @@ void        flush_font_metrics(void)
        for(; (ptr = (TFMPool *)tfmpool.head); ) {
                tfmpool.head = LIST(ptr->next);
                
-               xfree(ptr->short_name);
-               xfree(ptr->tfminfo.chars);
-               xfree(ptr);
+               mdvi_free(ptr->short_name);
+               mdvi_free(ptr->tfminfo.chars);
+               mdvi_free(ptr);
        }
        mdvi_hash_reset(&tfmhash, 0);
 }
index d04d33d7b316fba9648d04b42275c6ac0a697507..2e699405897861ad2cde5ced49aae4d9634761af 100644 (file)
@@ -274,7 +274,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info)
 
 tt_error:
        tt_font_remove(info);
-       xfree(font->chars);
+       mdvi_free(font->chars);
        font->chars = NULL;
        font->loc = font->hic = 0;
        return -1;
@@ -377,13 +377,13 @@ static int tt_get_bitmap(DviParams *params, DviFont *font,
        raster.cols = ROUND(w, 8);
        raster.size = h * raster.cols;
        raster.flow = TT_Flow_Down;
-       raster.bitmap = xcalloc(h, raster.cols);
+       raster.bitmap = mdvi_calloc(h, raster.cols);
        
        TT_Translate_Outline(&outline, -bbox.xMin, -bbox.yMin);
        TT_Get_Outline_Bitmap(tt_handle, &outline, &raster);
        glyph->data = bitmap_convert_msb8(raster.bitmap, w, h);
        TT_Done_Outline(&outline);
-       xfree(raster.bitmap);
+       mdvi_free(raster.bitmap);
        
        return 0;
 tt_error:
@@ -474,8 +474,8 @@ static void tt_font_remove(FTInfo *info)
        if(info->tfminfo)
                free_font_metrics(info->tfminfo);
        if(info->fmfname)
-               xfree(info->fmfname);
-       xfree(info);
+               mdvi_free(info->fmfname);
+       mdvi_free(info);
 }
 
 static void tt_free_data(DviFont *font)
index e7c73261e9528ea58cb2678f43d9da4c901ca34b..c1cc649e2b427f0421757bf9832df7e160dbf7fc 100644 (file)
@@ -203,7 +203,7 @@ void        fatal(const char *format, ...)
 #endif
 }
 
-void   *xmalloc(size_t nelems)
+void   *mdvi_malloc(size_t nelems)
 {
        void    *ptr = malloc(nelems);
        
@@ -213,7 +213,7 @@ void        *xmalloc(size_t nelems)
        return ptr;
 }
 
-void   *xrealloc(void *data, size_t newsize)
+void   *mdvi_realloc(void *data, size_t newsize)
 {
        void    *ptr;
        
@@ -225,7 +225,7 @@ void        *xrealloc(void *data, size_t newsize)
        return ptr;     
 }
 
-void   *xcalloc(size_t nmemb, size_t size)
+void   *mdvi_calloc(size_t nmemb, size_t size)
 {
        void    *ptr;
        
@@ -241,33 +241,33 @@ void      *xcalloc(size_t nmemb, size_t size)
        return ptr;
 }
 
-void   xfree(void *ptr)
+void   mdvi_free(void *ptr)
 {
        if(ptr == NULL)
                crash(_("attempted to free NULL pointer\n"));
        free(ptr);
 }
 
-char   *xstrdup(const char *string)
+char   *mdvi_strdup(const char *string)
 {
        int     length;
        char    *ptr;
        
        length = strlen(string) + 1;
-       ptr = (char *)xmalloc(length);
+       ptr = (char *)mdvi_malloc(length);
        memcpy(ptr, string, length);
        return ptr;
 }
 
 /* `to' should have room for length+1 bytes */
-char   *xstrncpy(char *to, const char *from, size_t length)
+char   *mdvi_strncpy(char *to, const char *from, size_t length)
 {
        strncpy(to, from, length);
        to[length] = '\0';
        return to;
 }
 
-char   *xstrndup(const char *string, size_t length)
+char   *mdvi_strndup(const char *string, size_t length)
 {
        int     n;
        char    *ptr;
@@ -275,14 +275,14 @@ char      *xstrndup(const char *string, size_t length)
        n = strlen(string);
        if(n > length)
                n = length;
-       ptr = (char *)xmalloc(n + 1);
+       ptr = (char *)mdvi_malloc(n + 1);
        memcpy(ptr, string, n);
        return ptr;
 }
 
-void   *xmemdup(const void *data, size_t length)
+void   *mdvi_memdup(const void *data, size_t length)
 {
-       void    *ptr = xmalloc(length);
+       void    *ptr = mdvi_malloc(length);
        
        memcpy(ptr, data, length);
        return ptr;
@@ -352,7 +352,7 @@ char        *xstradd(char *dest, size_t *size, size_t n, const char *src, size_t m)
        if(m == 0)
                m = strlen(src);
        if(n + m >= *size) {
-               dest = xrealloc(dest, n + m + 1);
+               dest = mdvi_realloc(dest, n + m + 1);
                *size = n + m + 1;
        }
        memcpy(dest + n, src, m);
@@ -421,7 +421,7 @@ int dstring_append(Dstring *dstr, const char *string, int len)
        if(len) {
                if(dstr->length + len >= dstr->size) {
                        dstr->size = pow2(dstr->length + len + 1);
-                       dstr->data = xrealloc(dstr->data, dstr->size);
+                       dstr->data = mdvi_realloc(dstr->data, dstr->size);
                }
                memcpy(dstr->data + dstr->length, string, len);
                dstr->length += len;
@@ -429,7 +429,7 @@ int dstring_append(Dstring *dstr, const char *string, int len)
        } else if(dstr->size == 0) {
                ASSERT(dstr->data == NULL);
                dstr->size = 8;
-               dstr->data = xmalloc(8);
+               dstr->data = mdvi_malloc(8);
                dstr->data[0] = 0;
        }
                
@@ -461,7 +461,7 @@ int dstring_insert(Dstring *dstr, int pos, const char *string, int len)
        if(len) {
                if(dstr->length + len >= dstr->size) {
                        dstr->size = pow2(dstr->length + len + 1);
-                       dstr->data = xrealloc(dstr->data, dstr->size);
+                       dstr->data = mdvi_realloc(dstr->data, dstr->size);
                }
                /* make room */
                memmove(dstr->data + pos, dstr->data + pos + len, len);
@@ -479,7 +479,7 @@ int dstring_new(Dstring *dstr, const char *string, int len)
                len = strlen(string);
        if(len) {
                dstr->size = pow2(len + 1);
-               dstr->data = xmalloc(dstr->size * len);
+               dstr->data = mdvi_malloc(dstr->size * len);
                memcpy(dstr->data, string, len);
        } else
                dstring_init(dstr);
@@ -489,7 +489,7 @@ int dstring_new(Dstring *dstr, const char *string, int len)
 void   dstring_reset(Dstring *dstr)
 {
        if(dstr->data)
-               xfree(dstr->data);
+               mdvi_free(dstr->data);
        dstring_init(dstr);
 }
 
index 86185f3662b4a55b063e5830430a08d279009e43..e1397fd587c0eae3e728979ebb612f2c82453b9f 100644 (file)
@@ -116,7 +116,7 @@ static int vf_load_font(DviParams *params, DviFont *font)
                hdpi = FROUND(params->mag * params->dpi * scale / design);
                vdpi = FROUND(params->mag * params->vdpi * scale / design);
                n = fuget1(p) + fuget1(p);
-               name = xmalloc(n + 1);
+               name = mdvi_malloc(n + 1);
                fread(name, 1, n, p);
                name[n] = 0;
                DEBUG((DBG_FONTS, "(vf) %s: defined font `%s' at %.1fpt (%dx%d dpi)\n",
@@ -130,7 +130,7 @@ static int vf_load_font(DviParams *params, DviFont *font)
                                font->fontname, name);
                        goto error;
                }
-               xfree(name);
+               mdvi_free(name);
                if(last == NULL)
                        font->subfonts = last = ref;
                else
@@ -228,13 +228,13 @@ badvf:
        error(_("%s: File corrupted, or not a VF file.\n"), font->fontname);
 error:
        if(font->chars)
-               xfree(font->chars);
+               mdvi_free(font->chars);
        if(macros)
-               xfree(macros);
+               mdvi_free(macros);
        return -1;
 }
 
 static void vf_free_macros(DviFont *font)
 {
-       xfree(font->private);   
+       mdvi_free(font->private);       
 }
index cb3994034ffcbe07afa360282f55d3d31c4e5e6f..d5164f1d67333e8d620f1054da34321af7e8aa7c 100644 (file)
@@ -2174,7 +2174,7 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
                "name", _("Evince"),
                "version", VERSION,
                "copyright",
-               _("\xc2\xa9 1996-2004 The Evince authors"),
+               _("\xc2\xa9 1996-2005 The Evince authors"),
                "license", license_trans,
                "website", "http://www.gnome.org/projects/evince",
                "comments", comments,