[Scummvm-cvs-logs] SF.net SVN: scummvm:[38463] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Feb 18 11:20:48 CET 2009


Revision: 38463
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38463&view=rev
Author:   thebluegr
Date:     2009-02-18 10:20:48 +0000 (Wed, 18 Feb 2009)

Log Message:
-----------
Removed the unused memtest, memdup and sci_memdup functions

Modified Paths:
--------------
    scummvm/trunk/engines/sci/include/resource.h
    scummvm/trunk/engines/sci/include/sci_memory.h
    scummvm/trunk/engines/sci/scicore/sci_memory.cpp
    scummvm/trunk/engines/sci/scicore/tools.cpp

Modified: scummvm/trunk/engines/sci/include/resource.h
===================================================================
--- scummvm/trunk/engines/sci/include/resource.h	2009-02-18 10:14:41 UTC (rev 38462)
+++ scummvm/trunk/engines/sci/include/resource.h	2009-02-18 10:20:48 UTC (rev 38463)
@@ -188,18 +188,6 @@
 
 /* --- */
 
-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

Modified: scummvm/trunk/engines/sci/include/sci_memory.h
===================================================================
--- scummvm/trunk/engines/sci/include/sci_memory.h	2009-02-18 10:14:41 UTC (rev 38462)
+++ scummvm/trunk/engines/sci/include/sci_memory.h	2009-02-18 10:20:48 UTC (rev 38463)
@@ -147,16 +147,6 @@
 ** 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);

Modified: scummvm/trunk/engines/sci/scicore/sci_memory.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/sci_memory.cpp	2009-02-18 10:14:41 UTC (rev 38462)
+++ scummvm/trunk/engines/sci/scicore/sci_memory.cpp	2009-02-18 10:20:48 UTC (rev 38463)
@@ -66,21 +66,6 @@
 }
 
 
-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;

Modified: scummvm/trunk/engines/sci/scicore/tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/tools.cpp	2009-02-18 10:14:41 UTC (rev 38462)
+++ scummvm/trunk/engines/sci/scicore/tools.cpp	2009-02-18 10:20:48 UTC (rev 38463)
@@ -83,69 +83,6 @@
 #	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;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list