diff options
author | V Narayanan <v.narayanan@sun.com> | 2009-07-17 14:25:09 +0530 |
---|---|---|
committer | V Narayanan <v.narayanan@sun.com> | 2009-07-17 14:25:09 +0530 |
commit | 18cc9fd478811d23c1ac96a7ad472cafc6f6a55d (patch) | |
tree | eb882980f87d87818f41202b571dd948870f38e4 /mysys/array.c | |
parent | b6b56895490593aad2880442feb1f10604126b8e (diff) | |
parent | 55588472262a43421568d92752f80911b6f4f40a (diff) | |
download | mariadb-git-18cc9fd478811d23c1ac96a7ad472cafc6f6a55d.tar.gz |
merging with mysql-5.0-bugteam
Diffstat (limited to 'mysys/array.c')
-rw-r--r-- | mysys/array.c | 14 |
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); } |