diff options
author | unknown <mikael@c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se> | 2006-06-14 08:51:39 -0400 |
---|---|---|
committer | unknown <mikael@c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se> | 2006-06-14 08:51:39 -0400 |
commit | 179c979937bf8fafef7931ce79304fd66a1eaff3 (patch) | |
tree | c3357efb607b156fe28aa7f574fc751359477fb5 /sql/partition_info.cc | |
parent | 2ecd916de6f0daebb22f79cd6f0ad09f581c2aec (diff) | |
parent | a4c2d33ed976de778f1ff526b6d524a3ffe844c9 (diff) | |
download | mariadb-git-179c979937bf8fafef7931ce79304fd66a1eaff3.tar.gz |
Merge c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/clean-mysql-5.1
into c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19801
mysql-test/r/partition.result:
Auto merged
mysql-test/t/partition.test:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/partition_info.cc:
manual merge
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r-- | sql/partition_info.cc | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 59cedc884b6..8ebc8e871a7 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -569,7 +569,6 @@ bool partition_info::check_list_constants() uint i; uint list_index= 0; longlong *list_value; - bool not_first; bool result= TRUE; longlong curr_value, prev_value; partition_element* part_def; @@ -614,7 +613,8 @@ bool partition_info::check_list_constants() no_list_values++; } while (++i < no_parts); list_func_it.rewind(); - list_array= (LIST_PART_ENTRY*)sql_alloc(no_list_values*sizeof(LIST_PART_ENTRY)); + list_array= (LIST_PART_ENTRY*)sql_alloc((no_list_values+1) * + sizeof(LIST_PART_ENTRY)); if (unlikely(list_array == NULL)) { mem_alloc_error(no_list_values * sizeof(LIST_PART_ENTRY)); @@ -633,24 +633,28 @@ bool partition_info::check_list_constants() } } while (++i < no_parts); - qsort((void*)list_array, no_list_values, sizeof(LIST_PART_ENTRY), - &list_part_cmp); - - not_first= FALSE; - prev_value= 0; // prev_value initialised to quiet compiler - for (i= 0; i < no_list_values ; i++) + if (no_list_values) { - curr_value= list_array[i].list_value; - if (likely(!not_first || prev_value != curr_value)) - { - prev_value= curr_value; - not_first= TRUE; - } - else + bool first= TRUE; + qsort((void*)list_array, no_list_values, sizeof(LIST_PART_ENTRY), + &list_part_cmp); + + i= prev_value= 0; //prev_value initialised to quiet compiler + do { - my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0)); - goto end; - } + DBUG_ASSERT(i < no_list_values); + curr_value= list_array[i].list_value; + if (likely(first || prev_value != curr_value)) + { + prev_value= curr_value; + first= FALSE; + } + else + { + my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0)); + goto end; + } + } while (++i < no_list_values); } result= FALSE; end: |