summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-04-02 18:56:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:49:45 -0500
commit769efdf048d80c4081487d555649de0f31738dd1 (patch)
tree538aa4fc93b57c463be8a87345bffed8aadc3a85 /source4
parent3655b4ba757a1db84063907ba9a2c157aef9bdbb (diff)
downloadsamba-769efdf048d80c4081487d555649de0f31738dd1.tar.gz
samba-769efdf048d80c4081487d555649de0f31738dd1.tar.bz2
samba-769efdf048d80c4081487d555649de0f31738dd1.zip
r22041: merge trivial changes from samba3
metze (This used to be commit 902a76ca705f07c61f86a9ef1346583ba9d3157d)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/tdb/common/freelistcheck.c2
-rw-r--r--source4/lib/tdb/common/io.c8
-rw-r--r--source4/lib/tdb/common/open.c4
-rw-r--r--source4/lib/tdb/common/tdb.c5
-rw-r--r--source4/lib/tdb/common/transaction.c15
-rw-r--r--source4/lib/tdb/include/tdb.h2
6 files changed, 20 insertions, 16 deletions
diff --git a/source4/lib/tdb/common/freelistcheck.c b/source4/lib/tdb/common/freelistcheck.c
index 3f79a016b8..63d2dbadc2 100644
--- a/source4/lib/tdb/common/freelistcheck.c
+++ b/source4/lib/tdb/common/freelistcheck.c
@@ -39,7 +39,7 @@ static int seen_insert(struct tdb_context *mem_tdb, tdb_off_t rec_ptr)
TDB_DATA key, data;
memset(&data, '\0', sizeof(data));
- key.dptr = (char *)&rec_ptr;
+ key.dptr = (unsigned char *)&rec_ptr;
key.dsize = sizeof(rec_ptr);
return tdb_store(mem_tdb, key, data, TDB_INSERT);
}
diff --git a/source4/lib/tdb/common/io.c b/source4/lib/tdb/common/io.c
index b3d1c56dc4..cd06dbb1e3 100644
--- a/source4/lib/tdb/common/io.c
+++ b/source4/lib/tdb/common/io.c
@@ -124,8 +124,10 @@ static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
if (ret != (ssize_t)len) {
/* Ensure ecode is set for log fn. */
tdb->ecode = TDB_ERR_IO;
- TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_read failed at %d len=%d ret=%d (%s) map_size=%d\n",
- off, len, ret, strerror(errno), (int)tdb->map_size));
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_read failed at %d "
+ "len=%d ret=%d (%s) map_size=%d\n",
+ (int)off, (int)len, (int)ret, strerror(errno),
+ (int)tdb->map_size));
return TDB_ERRCODE(TDB_ERR_IO, -1);
}
}
@@ -339,7 +341,7 @@ unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len
len = 1;
}
- if (!(buf = malloc(len))) {
+ if (!(buf = (unsigned char *)malloc(len))) {
/* Ensure ecode is set for log fn. */
tdb->ecode = TDB_ERR_OOM;
TDB_LOG((tdb, TDB_DEBUG_ERROR,"tdb_alloc_read malloc failed len=%d (%s)\n",
diff --git a/source4/lib/tdb/common/open.c b/source4/lib/tdb/common/open.c
index 47e3258c09..c7fd3f6656 100644
--- a/source4/lib/tdb/common/open.c
+++ b/source4/lib/tdb/common/open.c
@@ -372,9 +372,9 @@ int tdb_close(struct tdb_context *tdb)
/* register a loging function */
void tdb_set_logging_function(struct tdb_context *tdb,
- const struct tdb_logging_context *log)
+ const struct tdb_logging_context *log_ctx)
{
- tdb->log = *log;
+ tdb->log = *log_ctx;
}
void *tdb_get_logging_private(struct tdb_context *tdb)
diff --git a/source4/lib/tdb/common/tdb.c b/source4/lib/tdb/common/tdb.c
index a6b472ae94..25103d826e 100644
--- a/source4/lib/tdb/common/tdb.c
+++ b/source4/lib/tdb/common/tdb.c
@@ -564,9 +564,10 @@ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
dbuf = tdb_fetch(tdb, key);
if (dbuf.dptr == NULL) {
- dbuf.dptr = malloc(new_dbuf.dsize);
+ dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize);
} else {
- dbuf.dptr = realloc(dbuf.dptr, dbuf.dsize + new_dbuf.dsize);
+ dbuf.dptr = (unsigned char *)realloc(dbuf.dptr,
+ dbuf.dsize + new_dbuf.dsize);
}
if (dbuf.dptr == NULL) {
diff --git a/source4/lib/tdb/common/transaction.c b/source4/lib/tdb/common/transaction.c
index 5c94eb0afe..eb296206f9 100644
--- a/source4/lib/tdb/common/transaction.c
+++ b/source4/lib/tdb/common/transaction.c
@@ -39,7 +39,7 @@
by the header. This removes the need for extra journal files as
used by some other databases
- - dymacially allocated the transaction recover record, re-using it
+ - dynamically allocated the transaction recover record, re-using it
for subsequent transactions. If a larger record is needed then
tdb_free() the old record to place it on the normal tdb freelist
before allocating the new record
@@ -88,6 +88,12 @@
*/
+struct tdb_transaction_el {
+ struct tdb_transaction_el *next, *prev;
+ tdb_off_t offset;
+ tdb_len_t length;
+ unsigned char *data;
+};
/*
hold the context of any current transaction
@@ -105,12 +111,7 @@ struct tdb_transaction {
ordered, with first element at the front of the list. It
needs to be doubly linked as the read/write traversals need
to be backwards, while the commit needs to be forwards */
- struct tdb_transaction_el {
- struct tdb_transaction_el *next, *prev;
- tdb_off_t offset;
- tdb_len_t length;
- unsigned char *data;
- } *elements, *elements_last;
+ struct tdb_transaction_el *elements, *elements_last;
/* non-zero when an internal transaction error has
occurred. All write operations will then fail until the
diff --git a/source4/lib/tdb/include/tdb.h b/source4/lib/tdb/include/tdb.h
index e54c9b8da2..dafe2a130e 100644
--- a/source4/lib/tdb/include/tdb.h
+++ b/source4/lib/tdb/include/tdb.h
@@ -98,7 +98,7 @@ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
int tdb_reopen(struct tdb_context *tdb);
int tdb_reopen_all(int parent_longlived);
-void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log);
+void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
enum TDB_ERROR tdb_error(struct tdb_context *tdb);
const char *tdb_errorstr(struct tdb_context *tdb);
TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);