Commit 6e0f43ae authored by marko's avatar marko

branches/zip: Minor cleanup.

dtuple_create(): Simplify a pointer expression.  Flag the fields uninitialized
after initializing them in the debug version.

dtuple_t: Only declare magic_n if UNIV_DEBUG is defined.  The field is
not assigned to nor tested unless UNIV_DEBUG is defined.
parent abaca588
...@@ -410,9 +410,11 @@ struct dtuple_struct { ...@@ -410,9 +410,11 @@ struct dtuple_struct {
UT_LIST_NODE_T(dtuple_t) tuple_list; UT_LIST_NODE_T(dtuple_t) tuple_list;
/* data tuples can be linked into a /* data tuples can be linked into a
list using this field */ list using this field */
#ifdef UNIV_DEBUG
ulint magic_n; ulint magic_n;
# define DATA_TUPLE_MAGIC_N 65478679
#endif /* UNIV_DEBUG */
}; };
#define DATA_TUPLE_MAGIC_N 65478679
/* A slot for a field in a big rec vector */ /* A slot for a field in a big rec vector */
......
...@@ -325,7 +325,7 @@ dtuple_create( ...@@ -325,7 +325,7 @@ dtuple_create(
tuple->info_bits = 0; tuple->info_bits = 0;
tuple->n_fields = n_fields; tuple->n_fields = n_fields;
tuple->n_fields_cmp = n_fields; tuple->n_fields_cmp = n_fields;
tuple->fields = (dfield_t*)(((byte*)tuple) + sizeof(dtuple_t)); tuple->fields = (dfield_t*) &tuple[1];
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
tuple->magic_n = DATA_TUPLE_MAGIC_N; tuple->magic_n = DATA_TUPLE_MAGIC_N;
...@@ -343,6 +343,8 @@ dtuple_create( ...@@ -343,6 +343,8 @@ dtuple_create(
dfield_get_type(field)->mtype = DATA_ERROR; dfield_get_type(field)->mtype = DATA_ERROR;
} }
} }
UNIV_MEM_INVALID(tuple->fields, n_fields * sizeof *tuple->fields);
#endif #endif
return(tuple); return(tuple);
} }
......
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