r22041: merge trivial changes from samba3
authorStefan Metzmacher <metze@samba.org>
Mon, 2 Apr 2007 18:56:25 +0000 (18:56 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:49:45 +0000 (14:49 -0500)
metze

source/lib/tdb/common/freelistcheck.c
source/lib/tdb/common/io.c
source/lib/tdb/common/open.c
source/lib/tdb/common/tdb.c
source/lib/tdb/common/transaction.c
source/lib/tdb/include/tdb.h

index 3f79a016b8646cfdb128778d9739accf6de19ee7..63d2dbadc257cbb58bb6bf075829519f959c4a73 100644 (file)
@@ -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));
        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);
 }
        key.dsize = sizeof(rec_ptr);
        return tdb_store(mem_tdb, key, data, TDB_INSERT);
 }
index b3d1c56dc4db85816ec647420332b867095782a2..cd06dbb1e38be7b57cf84f35ac3486df97eb69fa 100644 (file)
@@ -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;
                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);
                }
        }
                        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;
        }
 
                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",
                /* 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",
index 47e3258c09fc07a001feb475f3722a75b579d1f5..c7fd3f66564795b05a410563e300cc224e4f9e2d 100644 (file)
@@ -372,9 +372,9 @@ int tdb_close(struct tdb_context *tdb)
 
 /* register a loging function */
 void tdb_set_logging_function(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)
 }
 
 void *tdb_get_logging_private(struct tdb_context *tdb)
index a6b472ae94f135f9841ae6b76cf42f4ddce2589b..25103d826e5f0e9398e76f371ac9ef437b87a993 100644 (file)
@@ -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 = tdb_fetch(tdb, key);
 
        if (dbuf.dptr == NULL) {
-               dbuf.dptr = malloc(new_dbuf.dsize);
+               dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize);
        } else {
        } 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) {
        }
 
        if (dbuf.dptr == NULL) {
index 5c94eb0afef991a8f87a4dbacfa414d747fee33c..eb296206f9f4be905a6f33bd54172c80b6a2d5af 100644 (file)
@@ -39,7 +39,7 @@
     by the header. This removes the need for extra journal files as
     used by some other databases
 
     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
     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
 
 */
 
 
 */
 
+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
 
 /*
   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 */
           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
 
        /* non-zero when an internal transaction error has
           occurred. All write operations will then fail until the
index e54c9b8da271f893b001ada51d56eae58c4a56b7..dafe2a130ece79865c2a2aeea20a4ecc172f2f04 100644 (file)
@@ -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);
 
 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);
 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);