Commit 7c003835 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

A better fix for #865. Fixes #865.

git-svn-id: file:///svn/tokudb@4166 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2f35b4cf
...@@ -14,14 +14,12 @@ static void ybt_test0 (void) { ...@@ -14,14 +14,12 @@ static void ybt_test0 (void) {
toku_init_dbt(&t0); toku_init_dbt(&t0);
toku_init_dbt(&t1); toku_init_dbt(&t1);
{ {
char* temp1 = "hello"; bytevec temp1 = "hello";
char**temp1p = &temp1; toku_dbt_set_value(&t0, &temp1, 6, &v0, FALSE);
toku_dbt_set_value(&t0, (bytevec*)temp1p, 6, &v0, FALSE);
} }
{ {
char* temp2 = "foo"; bytevec temp2 = "foo";
char**temp2p = &temp2; toku_dbt_set_value(&t1, &temp2, 4, &v1, FALSE);
toku_dbt_set_value(&t1, (bytevec*)temp2p, 4, &v1, FALSE);
} }
assert(t0.size==6); assert(t0.size==6);
assert(strcmp(t0.data, "hello")==0); assert(strcmp(t0.data, "hello")==0);
...@@ -29,9 +27,8 @@ static void ybt_test0 (void) { ...@@ -29,9 +27,8 @@ static void ybt_test0 (void) {
assert(strcmp(t1.data, "foo")==0); assert(strcmp(t1.data, "foo")==0);
{ {
char* temp3 = "byebye"; bytevec temp3 = "byebye";
char**temp3p= &temp3; toku_dbt_set_value(&t1, &temp3, 7, &v0, FALSE); /* Use v0, not v1 */
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 // This assertion would be wrong, since v0 may have been realloc'd, and t0.data may now point
// at the wrong place // at the wrong place
...@@ -46,9 +43,8 @@ static void ybt_test0 (void) { ...@@ -46,9 +43,8 @@ static void ybt_test0 (void) {
t0.flags = DB_DBT_USERMEM; t0.flags = DB_DBT_USERMEM;
t0.ulen = 0; t0.ulen = 0;
{ {
char* temp4 = "hello"; bytevec temp4 = "hello";
char**temp4p=&temp4; toku_dbt_set_value(&t0, &temp4, 6, 0, FALSE);
toku_dbt_set_value(&t0, (bytevec*)temp4p, 6, 0, FALSE);
} }
assert(t0.data==0); assert(t0.data==0);
assert(t0.size==6); assert(t0.size==6);
...@@ -58,18 +54,16 @@ static void ybt_test0 (void) { ...@@ -58,18 +54,16 @@ static void ybt_test0 (void) {
t0.flags = DB_DBT_REALLOC; t0.flags = DB_DBT_REALLOC;
v0 = 0; v0 = 0;
{ {
char* temp5 = "internationalization"; bytevec temp5 = "internationalization";
char**temp5p= &temp5; toku_dbt_set_value(&t0, &temp5, 21, &v0, FALSE);
toku_dbt_set_value(&t0, (bytevec*)temp5p, 21, &v0, FALSE);
} }
assert(v0==0); /* Didn't change v0 */ assert(v0==0); /* Didn't change v0 */
assert(t0.size==21); assert(t0.size==21);
assert(strcmp(t0.data, "internationalization")==0); assert(strcmp(t0.data, "internationalization")==0);
{ {
char* temp6 = "provincial"; bytevec temp6 = "provincial";
char**temp6p= &temp6; toku_dbt_set_value(&t0, &temp6, 11, &v0, FALSE);
toku_dbt_set_value(&t0, (bytevec*)temp6p, 11, &v0, FALSE);
} }
assert(t0.size==11); assert(t0.size==11);
assert(strcmp(t0.data, "provincial")==0); assert(strcmp(t0.data, "provincial")==0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment