Scrap wmem_memdup, it's not actually as useful as I thought it would be.

svn path=/trunk/; revision=50009
This commit is contained in:
Evan Huus 2013-06-18 19:01:01 +00:00
parent 115eb9c727
commit 881845a555
3 changed files with 0 additions and 48 deletions

View File

@ -99,17 +99,6 @@ wmem_realloc(wmem_allocator_t *allocator, void *ptr, const size_t size)
return allocator->realloc(allocator->private_data, ptr, size);
}
void *
wmem_memdup(wmem_allocator_t *allocator, const void *source, const size_t size)
{
void *dest;
dest = wmem_alloc(allocator, size);
memcpy(dest, source, size);
return dest;
}
static void
wmem_free_all_real(wmem_allocator_t *allocator, gboolean final)
{

View File

@ -135,18 +135,6 @@ void *
wmem_realloc(wmem_allocator_t *allocator, void *ptr, const size_t size)
G_GNUC_MALLOC;
/** Copies a block of memory.
*
* @param allocator The allocator object to use to allocate memory to copy into.
* @param source The pointer to the memory block to copy.
* @param size The amount of memory to copy.
* @return The location of the memory copy.
*/
WS_DLL_PUBLIC
void *
wmem_memdup(wmem_allocator_t *allocator, const void *source, const size_t size)
G_GNUC_MALLOC;
/** Frees all the memory allocated in a pool. Depending on the allocator
* implementation used this can be significantly cheaper than calling
* wmem_free() on all the individual blocks. It also doesn't require you to have

View File

@ -356,30 +356,6 @@ wmem_test_allocator_strict(void)
/* UTILITY TESTING FUNCTIONS (/wmem/utils/) */
static void
wmem_test_miscutls(void)
{
wmem_allocator_t *allocator;
const char *source = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *ret;
allocator = wmem_allocator_force_new(WMEM_ALLOCATOR_STRICT);
ret = (char*) wmem_memdup(allocator, source, 5);
ret[4] = '\0';
g_assert_cmpstr(ret, ==, "ABCD");
ret = (char*) wmem_memdup(allocator, source, 1);
g_assert(ret[0] == 'A');
wmem_strict_check_canaries(allocator);
ret = (char*) wmem_memdup(allocator, source, 10);
ret[9] = '\0';
g_assert_cmpstr(ret, ==, "ABCDEFGHI");
wmem_destroy_allocator(allocator);
}
static void
wmem_test_strutls(void)
{
@ -752,7 +728,6 @@ main(int argc, char **argv)
g_test_add_func("/wmem/allocator/times", wmem_time_allocators);
g_test_add_func("/wmem/allocator/callbacks", wmem_test_allocator_callbacks);
g_test_add_func("/wmem/utils/misc", wmem_test_miscutls);
g_test_add_func("/wmem/utils/strings", wmem_test_strutls);
g_test_add_func("/wmem/datastruct/slist", wmem_test_slist);