summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorSatya B <satya.bn@sun.com>2009-07-27 11:50:13 +0530
committerSatya B <satya.bn@sun.com>2009-07-27 11:50:13 +0530
commit2478d51032fbbf5123bdd6d25afceef9ee03f88a (patch)
tree79be006349537719c9e628bbca7dc66073647aa6 /mysys
parent30441aeadf28f053a75b58ec4c46d25dadc2ba97 (diff)
parentcf505e4494e86e09ce2c83af4dfe9f434eacb88c (diff)
downloadmariadb-git-2478d51032fbbf5123bdd6d25afceef9ee03f88a.tar.gz
merging with mysql-5.1-bugteam branch
Diffstat (limited to 'mysys')
-rw-r--r--mysys/array.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mysys/array.c b/mysys/array.c
index 92940717c90..b65bd28616d 100644
--- a/mysys/array.c
+++ b/mysys/array.c
@@ -32,11 +32,11 @@
DESCRIPTION
init_dynamic_array() initiates array and allocate space for
init_alloc eilements.
- Array is usable even if space allocation failed.
+ Array is usable even if space allocation failed, hence, the
+ function never returns TRUE.
Static buffers must begin immediately after the array structure.
RETURN VALUE
- TRUE my_malloc_ci() failed
FALSE Ok
*/
@@ -63,12 +63,12 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
array->size_of_element=element_size;
if ((array->buffer= init_buffer))
DBUG_RETURN(FALSE);
- if (!(array->buffer=(uchar*) my_malloc_ci(element_size*init_alloc,
- MYF(MY_WME))))
- {
+ /*
+ Since the dynamic array is usable even if allocation fails here malloc
+ should not throw an error
+ */
+ if (!(array->buffer= (char*) my_malloc_ci(element_size*init_alloc, MYF(0))))
array->max_element=0;
- DBUG_RETURN(TRUE);
- }
DBUG_RETURN(FALSE);
}