summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2012-08-20 16:47:12 +0000
committerKhaled Hosny <khaledhosny@eglug.org>2012-08-20 16:47:12 +0000
commit9c990fdbe8305f7397768daf2b6329143436c758 (patch)
treec0ffd7f60f5a80708c9b2a505fc8bf0e62e609a7
parent222161c445ee66ef6eb5fd8a3ebce5bb0a4d4828 (diff)
Remove memory debugging code
git-svn-id: svn://tug.org/texlive/trunk@27469 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dvipdfmx/ChangeLog.TL7
-rw-r--r--Build/source/texk/dvipdfmx/src/dvipdfmx.c4
-rw-r--r--Build/source/texk/dvipdfmx/src/mem.c118
-rw-r--r--Build/source/texk/dvipdfmx/src/mem.h33
-rw-r--r--Build/source/texk/dvipdfmx/src/xbb.c4
5 files changed, 9 insertions, 157 deletions
diff --git a/Build/source/texk/dvipdfmx/ChangeLog.TL b/Build/source/texk/dvipdfmx/ChangeLog.TL
index cd05258d2c2..df4e5f334ec 100644
--- a/Build/source/texk/dvipdfmx/ChangeLog.TL
+++ b/Build/source/texk/dvipdfmx/ChangeLog.TL
@@ -1,8 +1,13 @@
+2012-08-20 Khaled Hosny <khaledhosny@eglug.org>
+
+ * src/dvipdfmx.c, src/mem.c, src/mem.h, src/xbb.c, src/dvipdfmx.c,
+ src/mem.c, src/mem.h, src/xbb.c: Remove memory debugging code.
+
2012-08-18 Khaled Hosny <khaledhosny@eglug.org>
Move contents of dvipdfmx-20120420 to the top directory
* Makefile.am, configure.ac, data/Makefile.am, man/Makefile.am,
- src/Makefile.am: Adpated.
+ src/Makefile.am: Adapted.
* configure.in, m4/cho-kpse.m4, m4/cho-libs.m4, m4/maw-time.m4:
Removed.
diff --git a/Build/source/texk/dvipdfmx/src/dvipdfmx.c b/Build/source/texk/dvipdfmx/src/dvipdfmx.c
index 2c6ee0b0fb1..26b00493210 100644
--- a/Build/source/texk/dvipdfmx/src/dvipdfmx.c
+++ b/Build/source/texk/dvipdfmx/src/dvipdfmx.c
@@ -856,8 +856,6 @@ main (int argc, char *argv[])
return extractbb(argc, argv);
}
- mem_debug_init();
-
if (argc < 2) {
if (!really_quiet)
fprintf(stderr, "No dvi filename specified.");
@@ -1001,7 +999,5 @@ main (int argc, char *argv[])
miktex_uninitialize ();
#endif
- mem_debug_check();
-
return 0;
}
diff --git a/Build/source/texk/dvipdfmx/src/mem.c b/Build/source/texk/dvipdfmx/src/mem.c
index de5138904fd..61e544976bf 100644
--- a/Build/source/texk/dvipdfmx/src/mem.c
+++ b/Build/source/texk/dvipdfmx/src/mem.c
@@ -29,124 +29,6 @@
#include "mem.h"
#include "error.h"
-#ifdef MEM_DEBUG
-
-#include "dpxutil.h"
-
-#define MEM_LINE 180
-
-static struct ht_table *mem_ht;
-static long int mem_event;
-static int mem_internal;
-char *mem_str;
-
-void mem_debug_init(void)
-{
- mem_event = 0;
- mem_internal = 0;
- mem_ht = malloc(sizeof(struct ht_table));
- ht_init_table(mem_ht, NULL);
- fprintf(stderr, "*** Memory debugging started ***\n");
-}
-
-void mem_debug_check(void)
-{
- struct ht_iter iter;
-
- fprintf(stderr, "*** Memory still in use ***\n");
-
- if (ht_set_iter(mem_ht, &iter) == 0) {
- do {
- int pl;
- void *p = *((void **) ht_iter_getkey(&iter, &pl));
- char *s = ht_iter_getval(&iter);
-
- fprintf(stderr, "%p %s\n", p, s);
- } while (!ht_iter_next(&iter));
- }
- ht_clear_iter(&iter);
-
- fprintf(stderr, "*** End of used memory ***\n");
-}
-
-void *mem_add(void *ptr, const char *file, const char *function, int line) {
- if (ptr && !mem_internal) {
- char **p;
- mem_internal = 1;
- mem_str = malloc(MEM_LINE);
- p = malloc(sizeof(ptr));
- *p = ptr;
- snprintf(mem_str, MEM_LINE, "(0x%08lx) %s (%s, %d)"
-#ifdef __GNUC__
- ", %p" //" %p"
-#endif
- , ++mem_event, function, file, line
-#ifdef __GNUC__
- , __builtin_return_address(1) //, __builtin_return_address(2)
-#endif
- );
- ht_append_table(mem_ht, p, sizeof(ptr), mem_str);
- mem_internal = 0;
- }
-
- return ptr;
-}
-
-void *mem_remove(void *ptr, const char *file, const char *function, int line) {
- if (ptr && !mem_internal) {
- mem_internal = 1;
- if (!(mem_ht && ht_remove_table(mem_ht, &ptr, sizeof(ptr)))) {
- WARN("Trying to free non-allocated memory\n"
- "%p %s (%s, %d)"
-#ifdef __GNUC__
- ", called from %p"
-#endif
- "\n", ptr, function, file, line
-#ifdef __GNUC__
- , __builtin_return_address(1)
-#endif
- );
- }
- mem_internal = 0;
- }
-
- return ptr;
-}
-
-
-#else /* ! MEM_DEBUG */
-
-static long int mem_count;
-
-void mem_debug_init(void)
-{
- mem_count = 0;
-}
-
-void mem_debug_check(void)
-{
- if (mem_count)
- WARN("%ld memory objects still allocated\n"
- "You may want to report this to tex-k@tug.org\n", mem_count);
-}
-
-void *mem_add(void *ptr) {
- if (ptr)
- mem_count++;
-
- return ptr;
-}
-
-void *mem_remove(void *ptr) {
- if (ptr)
- mem_count--;
-
- return ptr;
-}
-
-#endif /* MEM_DEBUG */
-
-
void *new (size_t size)
{
void *result = malloc (size);
diff --git a/Build/source/texk/dvipdfmx/src/mem.h b/Build/source/texk/dvipdfmx/src/mem.h
index 852a011e168..263748a5885 100644
--- a/Build/source/texk/dvipdfmx/src/mem.h
+++ b/Build/source/texk/dvipdfmx/src/mem.h
@@ -30,35 +30,8 @@
extern void *new (size_t size);
extern void *renew (void *p, size_t size);
-extern void mem_debug_init(void);
-extern void mem_debug_check(void);
-
-#ifdef MEM_DEBUG
-
-extern void *mem_add (void *ptr,
- const char *file, const char *function, int line);
-extern void *mem_remove (void *ptr,
- const char *file, const char *function, int line);
-#define MEM_ADD(p) mem_add(p, __FILE__, __FUNCTION__, __LINE__)
-#define MEM_REMOVE(p) mem_remove(p, __FILE__, __FUNCTION__, __LINE__)
-
-#else /* ! MEM_DEBUG */
-
-extern void *mem_add (void *ptr);
-extern void *mem_remove (void *ptr);
-#define MEM_ADD(p) mem_add(p)
-#define MEM_REMOVE(p) mem_remove(p)
-
-#endif /* MEM_DEBUG */
-
-
-#define NEW(n,type) (type *) MEM_ADD(new(((size_t)(n))*sizeof(type)))
-#define RENEW(p,n,type) (type *) MEM_ADD(renew(MEM_REMOVE(p),(n)*sizeof(type)))
-#define RELEASE(p) free(MEM_REMOVE(p))
-
-/* wrappers for functions from kpathsea */
-#define kpse_path_search(x,y,z) (char *) MEM_ADD(kpse_path_search(x,y,z))
-#define kpse_find_file(x,y,z) (char *) MEM_ADD(kpse_find_file(x,y,z))
-#define kpse_find_glyph(x,y,z,w) (char *) MEM_ADD(kpse_find_glyph(x,y,z,w))
+#define NEW(n,type) (type *) new(((size_t)(n))*sizeof(type))
+#define RENEW(p,n,type) (type *) renew(p,(n)*sizeof(type))
+#define RELEASE(p) free(p)
#endif /* _MEM_H_ */
diff --git a/Build/source/texk/dvipdfmx/src/xbb.c b/Build/source/texk/dvipdfmx/src/xbb.c
index 2dba6550497..ed3d9bb0b98 100644
--- a/Build/source/texk/dvipdfmx/src/xbb.c
+++ b/Build/source/texk/dvipdfmx/src/xbb.c
@@ -232,8 +232,6 @@ static void do_pdf (FILE *fp, char *filename)
int extractbb (int argc, char *argv[])
{
- mem_debug_init();
-
pdf_files_init();
pdf_set_version(5);
@@ -333,7 +331,5 @@ int extractbb (int argc, char *argv[])
pdf_files_close();
- mem_debug_check();
-
return 0;
}