mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
Fix #865.
git-svn-id: file:///svn/tokudb@4160 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
45ab3f10cc
commit
85d3c99dca
1 changed files with 25 additions and 7 deletions
|
@ -13,17 +13,26 @@ static void ybt_test0 (void) {
|
|||
DBT t0,t1;
|
||||
toku_init_dbt(&t0);
|
||||
toku_init_dbt(&t1);
|
||||
char* temp1 = "hello";
|
||||
toku_dbt_set_value(&t0, (bytevec*)&temp1, 6, &v0, FALSE);
|
||||
{
|
||||
char* temp1 = "hello";
|
||||
char**temp1p = &temp1;
|
||||
toku_dbt_set_value(&t0, (bytevec*)temp1p, 6, &v0, FALSE);
|
||||
}
|
||||
{
|
||||
char* temp2 = "foo";
|
||||
toku_dbt_set_value(&t1, (bytevec*)&temp2, 4, &v1, FALSE);
|
||||
char**temp2p = &temp2;
|
||||
toku_dbt_set_value(&t1, (bytevec*)temp2p, 4, &v1, FALSE);
|
||||
}
|
||||
assert(t0.size==6);
|
||||
assert(strcmp(t0.data, "hello")==0);
|
||||
assert(t1.size==4);
|
||||
assert(strcmp(t1.data, "foo")==0);
|
||||
|
||||
{
|
||||
char* temp3 = "byebye";
|
||||
toku_dbt_set_value(&t1, (bytevec*)&temp3, 7, &v0, FALSE); /* Use v0, not v1 */
|
||||
char**temp3p= &temp3;
|
||||
toku_dbt_set_value(&t1, (bytevec*)temp3p, 7, &v0, FALSE); /* Use v0, not v1 */
|
||||
}
|
||||
// This assertion would be wrong, since v0 may have been realloc'd, and t0.data may now point
|
||||
// at the wrong place
|
||||
//assert(strcmp(t0.data, "byebye")==0); /* t0's data should be changed too, since it used v0 */
|
||||
|
@ -36,8 +45,11 @@ static void ybt_test0 (void) {
|
|||
toku_init_dbt(&t0);
|
||||
t0.flags = DB_DBT_USERMEM;
|
||||
t0.ulen = 0;
|
||||
{
|
||||
char* temp4 = "hello";
|
||||
toku_dbt_set_value(&t0, (bytevec*)&temp4, 6, 0, FALSE);
|
||||
char**temp4p=&temp4;
|
||||
toku_dbt_set_value(&t0, (bytevec*)temp4p, 6, 0, FALSE);
|
||||
}
|
||||
assert(t0.data==0);
|
||||
assert(t0.size==6);
|
||||
|
||||
|
@ -45,14 +57,20 @@ static void ybt_test0 (void) {
|
|||
toku_init_dbt(&t0);
|
||||
t0.flags = DB_DBT_REALLOC;
|
||||
v0 = 0;
|
||||
{
|
||||
char* temp5 = "internationalization";
|
||||
toku_dbt_set_value(&t0, (bytevec*)&temp5, 21, &v0, FALSE);
|
||||
char**temp5p= &temp5;
|
||||
toku_dbt_set_value(&t0, (bytevec*)temp5p, 21, &v0, FALSE);
|
||||
}
|
||||
assert(v0==0); /* Didn't change v0 */
|
||||
assert(t0.size==21);
|
||||
assert(strcmp(t0.data, "internationalization")==0);
|
||||
|
||||
{
|
||||
char* temp6 = "provincial";
|
||||
toku_dbt_set_value(&t0, (bytevec*)&temp6, 11, &v0, FALSE);
|
||||
char**temp6p= &temp6;
|
||||
toku_dbt_set_value(&t0, (bytevec*)temp6p, 11, &v0, FALSE);
|
||||
}
|
||||
assert(t0.size==11);
|
||||
assert(strcmp(t0.data, "provincial")==0);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue