@@ -695,6 +695,7 @@ struct node *read_node(struct connection *conn, const void *ctx,
TDB_DATA key, data;
struct xs_tdb_record_hdr *hdr;
struct node *node;
+ const char *db_name;
int err;
node = talloc(ctx, struct node);
@@ -709,7 +710,8 @@ struct node *read_node(struct connection *conn, const void *ctx,
return NULL;
}
- transaction_prepend(conn, name, &key);
+ db_name = transaction_prepend(conn, name);
+ set_tdb_key(db_name, &key);
data = tdb_fetch(tdb_ctx, key);
@@ -196,20 +196,17 @@ static char *transaction_get_node_name(void *ctx, struct transaction *trans,
* Prepend the transaction to name if node has been modified in the current
* transaction.
*/
-void transaction_prepend(struct connection *conn, const char *name,
- TDB_DATA *key)
+const char *transaction_prepend(struct connection *conn, const char *name)
{
struct accessed_node *i;
if (conn && conn->transaction) {
i = find_accessed_node(conn->transaction, name);
- if (i) {
- set_tdb_key(i->trans_name, key);
- return;
- }
+ if (i)
+ return i->trans_name;
}
- set_tdb_key(name, key);
+ return name;
}
/*
@@ -47,8 +47,7 @@ int __must_check access_node(struct connection *conn, struct node *node,
void queue_watches(struct connection *conn, const char *name, bool watch_exact);
/* Prepend the transaction to name if appropriate. */
-void transaction_prepend(struct connection *conn, const char *name,
- TDB_DATA *key);
+const char *transaction_prepend(struct connection *conn, const char *name);
/* Mark the transaction as failed. This will prevent it to be committed. */
void fail_transaction(struct transaction *trans);