]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb/io.c
various: add LICENSE comments.
[ccan] / ccan / tdb / io.c
index 5689d055b48df4e9cc5b966fdabd9b4a397e0c59..2262eabf93b19daf524b3876d8b7f55c1fe882ea 100644 (file)
@@ -125,9 +125,17 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
 /* Endian conversion: we only ever deal with 4 byte quantities */
 void *tdb_convert(void *buf, uint32_t size)
 {
-       uint32_t i, *p = (uint32_t *)buf;
-       for (i = 0; i < size / 4; i++)
-               p[i] = TDB_BYTEREV(p[i]);
+       uint32_t i;
+       unsigned char *p = buf, tmp;
+
+       for (i = 0; i < size; i += 4) {
+               tmp = p[i];
+               p[i] = p[i+3];
+               p[i+3] = tmp;
+               tmp = p[i+1];
+               p[i+1] = p[i+2];
+               p[i+2] = tmp;
+       }
        return buf;
 }
 
@@ -463,8 +471,6 @@ static const struct tdb_methods io_methods = {
        tdb_next_hash_chain,
        tdb_oob,
        tdb_expand_file,
-       tdb_brlock,
-       tdb_brunlock
 };
 
 /*