summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-13 19:12:06 +0000
committerJeremy Allison <jra@samba.org>2001-04-13 19:12:06 +0000
commit2ef68c7e92d4661664f0410509f7cb551e74a198 (patch)
tree7a3ea392bf8664e28ad46b2edb1afd750335ccc9 /source3/tdb
parent14748b0bf56239695cadb6aa40d9095259ebb6e2 (diff)
downloadsamba-2ef68c7e92d4661664f0410509f7cb551e74a198.tar.gz
samba-2ef68c7e92d4661664f0410509f7cb551e74a198.tar.bz2
samba-2ef68c7e92d4661664f0410509f7cb551e74a198.zip
Merge of Andrew's changes in 2.2.
Jeremy. (This used to be commit fc76681812b1469208ad6c8847afdfc68bc6db49)
Diffstat (limited to 'source3/tdb')
-rw-r--r--source3/tdb/tdb.c2
-rw-r--r--source3/tdb/tdbutil.c50
2 files changed, 3 insertions, 49 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index 39d061b0a8..d4bd3001fc 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -52,7 +52,7 @@
#define TDB_PAGE_SIZE 0x2000
#define FREELIST_TOP (sizeof(struct tdb_header))
#define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1))
-#define TDB_BYTEREV(x) (((x<<24)|(x&0xFF00)<<8)|((x>>8)&0xFF00)|(x>>24))
+#define TDB_BYTEREV(x) (((((x)&0xff)<<24)|((x)&0xFF00)<<8)|(((x)>>8)&0xFF00)|((x)>>24))
#define TDB_DEAD(r) ((r)->magic == TDB_DEAD_MAGIC)
#define TDB_BAD_MAGIC(r) ((r)->magic != TDB_MAGIC && !TDB_DEAD(r))
#define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off))
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c
index 27aac560e0..d683d70c46 100644
--- a/source3/tdb/tdbutil.c
+++ b/source3/tdb/tdbutil.c
@@ -120,44 +120,21 @@ TDB_DATA tdb_fetch_by_string(TDB_CONTEXT *tdb, char *keystr)
/* useful pair of routines for packing/unpacking data consisting of
integers and strings */
-#ifdef HAVE_STDARG_H
size_t tdb_pack(char *buf, int bufsize, char *fmt, ...)
{
-#else /* HAVE_STDARG_H */
- size_t tdb_pack(va_alist)
-va_dcl
-{
- char *buf, *fmt;
- int bufsize;
-#endif /* HAVE_STDARG_H */
va_list ap;
uint16 w;
uint32 d;
int i;
void *p;
- int len = 0;
+ int len;
char *s;
char c;
-#ifdef HAVE_STDARG_H
char *buf0 = buf;
char *fmt0 = fmt;
int bufsize0 = bufsize;
va_start(ap, fmt);
-#else /* HAVE_STDARG_H */
- char *buf0;
- char *fmt0;
- int bufsize0;
-
- va_start(ap);
- buf = va_arg(ap,char *);
- bufsize = va_arg(ap,int);
- fmt = va_arg(ap,char *);
-
- buf0 = buf;
- fmt0 = fmt;
- bufsize0 = bufsize;
-#endif /* HAVE_STDARG_H */
while (*fmt) {
switch ((c = *fmt++)) {
@@ -230,44 +207,21 @@ va_dcl
/* useful pair of routines for packing/unpacking data consisting of
integers and strings */
-#ifdef HAVE_STDARG_H
int tdb_unpack(char *buf, int bufsize, char *fmt, ...)
{
-#else /* HAVE_STDARG_H */
- int tdb_unpack(va_alist)
-va_dcl
-{
- char *buf, *fmt;
- int bufsize;
-#endif /* HAVE_STDARG_H */
va_list ap;
uint16 *w;
uint32 *d;
- int len = 0;
+ int len;
int *i;
void **p;
char *s, **b;
char c;
-#ifdef HAVE_STDARG_H
char *buf0 = buf;
char *fmt0 = fmt;
int bufsize0 = bufsize;
va_start(ap, fmt);
-#else /* HAVE_STDARG_H */
- char *buf0;
- char *fmt0;
- int bufsize0;
-
- va_start(ap);
- buf = va_arg(ap,char *);
- bufsize = va_arg(ap,int);
- fmt = va_arg(ap,char *);
-
- buf0 = buf;
- fmt0 = fmt;
- bufsize0 = bufsize;
-#endif /* HAVE_STDARG_H */
while (*fmt) {
switch ((c=*fmt++)) {