Commit 59f9fc4f authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi
Browse files

mem0mem.ic Changes to eliminate unnecessary Purify warnings

ut0mem.h	Changes to eliminate unnecessary Purify warnings
ut0mem.ic	Changes to eliminate unnecessary Purify warnings
srv0start.c	Changes to eliminate unnecessary Purify warnings
mem0pool.c	Changes to eliminate unnecessary Purify warnings
ut0mem.c	Changes to eliminate unnecessary Purify warnings
parent 1ac9e1e6
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -170,7 +170,9 @@ mem_heap_alloc(
	buf = (byte*)buf + MEM_FIELD_HEADER_SIZE;

	#endif

#ifdef UNIV_SET_MEM_TO_ZERO
	memset(buf, '\0', n);
#endif
	return(buf);
}

@@ -494,8 +496,14 @@ mem_alloc_func(
	)
{
	#ifndef UNIV_MEM_DEBUG
	void* buf;

	return(mem_area_alloc(n, mem_comm_pool));
	buf = mem_area_alloc(n, mem_comm_pool);

#ifdef UNIV_SET_MEM_TO_ZERO
	memset(buf, '\0', n);
#endif
	return(buf);
	
	#else
	
+30 −3
Original line number Diff line number Diff line
@@ -26,12 +26,39 @@ int
ut_memcmp(void* str1, void* str2, ulint n);


/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined and set_to_zero is TRUE. */

void*
ut_malloc(ulint n);
ut_malloc_low(
/*==========*/
	                     /* out, own: allocated memory */
        ulint   n,           /* in: number of bytes to allocate */
	ibool   set_to_zero); /* in: TRUE if allocated memory should be set
			     to zero if UNIV_SET_MEM_TO_ZERO is defined */
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined. */

void*
ut_malloc(
/*======*/
	                /* out, own: allocated memory */
        ulint   n);     /* in: number of bytes to allocate */
/**************************************************************************
Frees a memory bloock allocated with ut_malloc. */

void
ut_free(
/*====*/
	void* ptr);  /* in, own: memory block */
/**************************************************************************
Frees all allocated memory not freed yet. */

UNIV_INLINE
void
ut_free(void* ptr);
ut_free_all_mem(void);
/*=================*/

UNIV_INLINE
char*
+0 −7
Original line number Diff line number Diff line
@@ -27,13 +27,6 @@ ut_memcmp(void* str1, void* str2, ulint n)
	return(memcmp(str1, str2, n));
}

UNIV_INLINE
void
ut_free(void* ptr)
{
	free(ptr);
}

UNIV_INLINE
char*
ut_strcpy(char* dest, char* sour)
+5 −1
Original line number Diff line number Diff line
@@ -170,7 +170,11 @@ mem_pool_create(
	
	pool = ut_malloc(sizeof(mem_pool_t));

	pool->buf = ut_malloc(size);
	/* We do not set the memory to zero (FALSE) in the pool,
	but only when allocated at a higher level in mem0mem.c.
	This is to avoid masking useful Purify warnings. */

	pool->buf = ut_malloc_low(size, FALSE);
	pool->size = size;

	mutex_create(&(pool->mutex));
+2 −0
Original line number Diff line number Diff line
@@ -916,5 +916,7 @@ innobase_shutdown_for_mysql(void)

	logs_empty_and_mark_files_at_shutdown();

	ut_free_all_mem();

	return((int) DB_SUCCESS);
}
Loading