db: move db_field_log dtor out of union
This commit is contained in:
@@ -731,7 +731,7 @@ static db_field_log* db_create_field_log (struct dbChannel *chan, int use_val)
|
||||
/* don't make a copy yet, just reference the field value */
|
||||
pLog->u.r.field = dbChannelField(chan);
|
||||
/* indicate field value still owned by record */
|
||||
pLog->u.r.dtor = NULL;
|
||||
pLog->dtor = NULL;
|
||||
/* no private data yet, may be set by a filter */
|
||||
pLog->u.r.pvt = NULL;
|
||||
}
|
||||
@@ -1213,7 +1213,7 @@ void db_delete_field_log (db_field_log *pfl)
|
||||
{
|
||||
if (pfl) {
|
||||
/* Free field if reference type field log and dtor is set */
|
||||
if (pfl->type == dbfl_type_ref && pfl->u.r.dtor) pfl->u.r.dtor(pfl);
|
||||
if (pfl->type == dbfl_type_ref && pfl->dtor) pfl->dtor(pfl);
|
||||
/* Free the field log chunk */
|
||||
freeListFree(dbevFieldLogFreeList, pfl);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ struct dbfl_val {
|
||||
* data is still owned by a record. See the macro dbfl_has_copy below.
|
||||
*/
|
||||
struct dbfl_ref {
|
||||
dbfl_freeFunc *dtor; /* Callback to free filter-allocated resources */
|
||||
void *pvt; /* Private pointer */
|
||||
void *field; /* Field value */
|
||||
};
|
||||
@@ -120,6 +119,7 @@ typedef struct db_field_log {
|
||||
short field_type; /* DBF type of data */
|
||||
short field_size; /* Size of a single element */
|
||||
long no_elements; /* No of valid array elements */
|
||||
dbfl_freeFunc *dtor; /* Callback to free filter-allocated resources */
|
||||
union {
|
||||
struct dbfl_val v;
|
||||
struct dbfl_ref r;
|
||||
@@ -136,7 +136,7 @@ typedef struct db_field_log {
|
||||
* the db_field_log still owns the (empty) data.
|
||||
*/
|
||||
#define dbfl_has_copy(p)\
|
||||
((p) && ((p)->type==dbfl_type_val || (p)->u.r.dtor || (p)->no_elements==0))
|
||||
((p) && ((p)->type==dbfl_type_val || (p)->dtor || (p)->no_elements==0))
|
||||
|
||||
#define dbfl_pfield(p)\
|
||||
((p)->type==dbfl_type_val ? &p->u.v.field : p->u.r.field)
|
||||
|
||||
Reference in New Issue
Block a user