From 95cc0493b357869909ba850233c02265532029e1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 18 Feb 2009 10:20:48 +0000 Subject: Removed the unused memtest, memdup and sci_memdup functions svn-id: r38463 --- engines/sci/include/resource.h | 12 -------- engines/sci/include/sci_memory.h | 10 ------ engines/sci/scicore/sci_memory.cpp | 15 --------- engines/sci/scicore/tools.cpp | 63 -------------------------------------- 4 files changed, 100 deletions(-) (limited to 'engines') diff --git a/engines/sci/include/resource.h b/engines/sci/include/resource.h index 63cd846af5..10a29c7aa8 100644 --- a/engines/sci/include/resource.h +++ b/engines/sci/include/resource.h @@ -188,18 +188,6 @@ sci_get_from_queue(sci_queue_t *queue, int *type); /* --- */ -int -memtest(const char *file, int line); -/* Allocates, manipulates, and frees some memory -** Parameters: (const char *) file: The file name to print when starting the -** tests -** (int) line: The line number to claim it was executed on -** Returns : (int) 0 -** This function calls malloc(), free(), and memfrob() or memset() -** to provocate segmentation faults caused by dynamic allocation bugs -** in previous parts of the code. -*/ - void sci_gettime(long *seconds, long *useconds); /* Calculates the current time in seconds and microseconds diff --git a/engines/sci/include/sci_memory.h b/engines/sci/include/sci_memory.h index 21d3599197..10fc8666b5 100644 --- a/engines/sci/include/sci_memory.h +++ b/engines/sci/include/sci_memory.h @@ -147,16 +147,6 @@ extern void * ** See _SCI_MALLOC() for more information if call fails. */ -extern void * - sci_memdup(const void *src, size_t size); -/* Duplicates a chunk of memory -** Parameters: (void *) src: Pointer to the data to duplicate -** (size_t) size: Number of bytes to duplicate -** Returns : (void *) An appropriately allocated duplicate, or NULL on error -** Please try to avoid data duplication unless absolutely neccessary! -** To free this string, use the free() command. -** See _SCI_MALLOC() for more information if call fails. -*/ extern char * sci_strdup(const char *src); diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/scicore/sci_memory.cpp index b5f654dead..e612604687 100644 --- a/engines/sci/scicore/sci_memory.cpp +++ b/engines/sci/scicore/sci_memory.cpp @@ -66,21 +66,6 @@ sci_realloc(void *ptr, size_t size) { } -void * -sci_memdup(const void *ptr, size_t size) { - void *res; - if (!ptr) { - fprintf(stderr, "_SCI_MEMDUP() [%s (%s) : %u]\n", - __FILE__, "", __LINE__); - fprintf(stderr, " attempt to memdup NULL pointer\n"); - BREAKPOINT(); - } - ALLOC_MEM((res = malloc(size)), size, __FILE__, __LINE__, "") - memcpy(res, ptr, size); - return res; -} - - char * sci_strdup(const char *src) { void *res; diff --git a/engines/sci/scicore/tools.cpp b/engines/sci/scicore/tools.cpp index 4436ce2e41..86967ff225 100644 --- a/engines/sci/scicore/tools.cpp +++ b/engines/sci/scicore/tools.cpp @@ -83,69 +83,6 @@ int sci_debug_flags = 0; /* Special flags */ # define con_file 0 #endif -#define MEMTEST_HARDNESS 31 - -int -memtest(const char *file, int line) { - /* va_list argp; -- unused */ - int i; - void *blocks[MEMTEST_HARDNESS + 1]; - fprintf(stderr, "Memtesting in %s, L%d\n", file, line); - - for (i = 0; i < MEMTEST_HARDNESS; i++) { - blocks[i] = sci_malloc(1 + i); -#ifdef HAVE_MEMFROB - memfrob(blocks[i], 1 + i); -#else - memset(blocks[i], 42, 1 + i); -#endif - } - for (i = 0; i < MEMTEST_HARDNESS; i++) - free(blocks[i]); - - for (i = 0; i < MEMTEST_HARDNESS; i++) { - blocks[i] = sci_malloc(5 + i * 5); -#ifdef HAVE_MEMFROB - memfrob(blocks[i], 5 + i*5); -#else - memset(blocks[i], 42, 5 + i*5); -#endif - } - for (i = 0; i < MEMTEST_HARDNESS; i++) - free(blocks[i]); - - for (i = 0; i < MEMTEST_HARDNESS; i++) { - blocks[i] = sci_malloc(5 + i * 100); -#ifdef HAVE_MEMFROB - memfrob(blocks[i], 5 + i*100); -#else - memset(blocks[i], 42, 5 + i*100); -#endif - } - for (i = 0; i < MEMTEST_HARDNESS; i++) - free(blocks[i]); - - for (i = 0; i < MEMTEST_HARDNESS; i++) { - blocks[i] = sci_malloc(5 + i * 1000); -#ifdef HAVE_MEMFROB - memfrob(blocks[i], 5 + i * 1000); -#else - memset(blocks[i], 42, 5 + i * 1000); -#endif - } - for (i = 0; i < MEMTEST_HARDNESS; i++) - free(blocks[i]); - fprintf(stderr, "Memtest succeeded!\n"); - return 0; -} - -void * -memdup(void *src, int size) { - void *b = malloc(size); - memcpy(b, src, size); - return b; -} - int sci_ffs(int _mask) { int retval = 0; -- cgit v1.2.3