diff options
author | Volker Lendecke <vl@samba.org> | 2018-10-09 13:58:43 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-10-17 19:22:19 +0200 |
commit | 78b8b9164679d782ed0eb2608961972eb08f73f9 (patch) | |
tree | 88ad6abb1d6a42f8c87d28e8a473cf719a4345ea /source3 | |
parent | 34fe8b1ac6a79680fcbb34e9fcad2869d66d88e6 (diff) | |
download | samba-78b8b9164679d782ed0eb2608961972eb08f73f9.tar.gz |
gencache: Make gencache_pull_timeout return a payload DATA_BLOB
Both relevant callers created one anyway.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/gencache.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index d72aa9505af..eb268ad3ad1 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -408,7 +408,7 @@ bool gencache_del(const char *keystr) return result; } -static bool gencache_pull_timeout(TDB_DATA data, time_t *pres, char **payload) +static bool gencache_pull_timeout(TDB_DATA data, time_t *pres, DATA_BLOB *payload) { time_t res; char *slash = NULL; @@ -432,7 +432,11 @@ static bool gencache_pull_timeout(TDB_DATA data, time_t *pres, char **payload) *pres = res; } if (payload != NULL) { - *payload = endptr+1; + endptr += 1; + *payload = (DATA_BLOB) { + .data = discard_const_p(uint8_t, endptr), + .length = data.dsize - PTR_DIFF(endptr, data.dptr), + }; } return true; } @@ -448,9 +452,8 @@ struct gencache_parse_state { static int gencache_parse_fn(TDB_DATA key, TDB_DATA data, void *private_data) { struct gencache_parse_state *state; - DATA_BLOB blob; struct gencache_timeout t; - char *payload; + DATA_BLOB payload; bool ret; if (data.dptr == NULL) { @@ -461,9 +464,7 @@ static int gencache_parse_fn(TDB_DATA key, TDB_DATA data, void *private_data) return -1; } state = (struct gencache_parse_state *)private_data; - blob = data_blob_const( - payload, data.dsize - PTR_DIFF(payload, data.dptr)); - state->parser(&t, blob, state->private_data); + state->parser(&t, payload, state->private_data); if (state->copy_to_notrans) { tdb_store(cache_notrans->tdb, key, data, 0); @@ -826,7 +827,7 @@ static int gencache_iterate_blobs_fn(struct tdb_context *tdb, TDB_DATA key, char *keystr; char *free_key = NULL; time_t timeout; - char *payload; + DATA_BLOB payload; if (tdb_data_cmp(key, last_stabilize_key()) == 0) { return 0; @@ -863,10 +864,7 @@ static int gencache_iterate_blobs_fn(struct tdb_context *tdb, TDB_DATA key, "(key=[%s], timeout=[%s])\n", keystr, timestring(talloc_tos(), timeout))); - state->fn(keystr, - data_blob_const(payload, - data.dsize - PTR_DIFF(payload, data.dptr)), - timeout, state->private_data); + state->fn(keystr, payload, timeout, state->private_data); done: TALLOC_FREE(free_key); |