Commit 45e9956d authored by Rusty Russell's avatar Rusty Russell

tdb2: fix warnings with -Wcast-qual using ccan/cast.

parent 1313203b
......@@ -86,6 +86,7 @@ int main(int argc, char *argv[])
printf("ccan/failtest\n");
printf("ccan/tally\n");
printf("ccan/typesafe_cb\n");
printf("ccan/cast\n");
return 0;
}
......
......@@ -439,7 +439,7 @@ static enum TDB_ERROR tdb_expand_file(struct tdb_context *tdb,
const void *tdb_access_read(struct tdb_context *tdb,
tdb_off_t off, tdb_len_t len, bool convert)
{
const void *ret = NULL;
void *ret = NULL;
if (likely(!(tdb->flags & TDB_CONVERT))) {
ret = tdb->methods->direct(tdb, off, len, false);
......
......@@ -454,7 +454,7 @@ fail_errno:
#ifdef TDB_TRACE
close(tdb->tracefd);
#endif
free((char *)tdb->name);
free(cast_const(char *, tdb->name));
if (tdb->file) {
tdb_unlock_all(tdb);
if (--tdb->file->refcnt == 0) {
......@@ -495,7 +495,7 @@ int tdb_close(struct tdb_context *tdb)
else
tdb_munmap(tdb->file);
}
free((char *)tdb->name);
free(cast_const(char *, tdb->name));
if (tdb->file) {
struct tdb_file **i;
......
......@@ -35,6 +35,7 @@
#include <ccan/tdb2/tdb2.h>
#include <ccan/likely/likely.h>
#include <ccan/compiler/compiler.h>
#include <ccan/cast/cast.h>
#if HAVE_BYTESWAP_H
#include <byteswap.h>
#endif
......@@ -75,7 +76,7 @@ typedef uint64_t tdb_off_t;
/* Packing errors into pointers and v.v. */
#define TDB_PTR_IS_ERR(ptr) \
unlikely((void *)(ptr) >= (void *)(long)TDB_ERR_LAST)
unlikely((unsigned long)(ptr) >= (unsigned long)TDB_ERR_LAST)
#define TDB_PTR_ERR(p) ((enum TDB_ERROR)(long)(p))
#define TDB_ERR_PTR(err) ((void *)(long)(err))
......
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