diff options
author | Jeremy Allison <jra@samba.org> | 2001-04-13 19:12:06 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-04-13 19:12:06 +0000 |
commit | fc76681812b1469208ad6c8847afdfc68bc6db49 (patch) | |
tree | 016255c268fa14d259facf86e8b4c9ec357d0006 /source/tdb | |
parent | 4f06373bc450b27692619ae877d29767ad160297 (diff) | |
download | samba-fc76681812b1469208ad6c8847afdfc68bc6db49.tar.gz |
Merge of Andrew's changes in 2.2.
Jeremy.
Diffstat (limited to 'source/tdb')
-rw-r--r-- | source/tdb/tdb.c | 2 | ||||
-rw-r--r-- | source/tdb/tdbutil.c | 50 |
2 files changed, 3 insertions, 49 deletions
diff --git a/source/tdb/tdb.c b/source/tdb/tdb.c index 39d061b0a84..d4bd3001fcc 100644 --- a/source/tdb/tdb.c +++ b/source/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/source/tdb/tdbutil.c b/source/tdb/tdbutil.c index 27aac560e0a..d683d70c469 100644 --- a/source/tdb/tdbutil.c +++ b/source/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++)) { |