From 3a3ff8ebe7b7de24a7d3e2c9dd105d9fbeeb5d42 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 31 Jan 2008 09:48:46 +1100 Subject: merged tdb transaction fix (This used to be commit eb3af24926977208a8099c848a510704d2ae3524) --- source4/lib/tdb/common/transaction.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/tdb/common/transaction.c b/source4/lib/tdb/common/transaction.c index c3e7a4e2c0..4e2127be64 100644 --- a/source4/lib/tdb/common/transaction.c +++ b/source4/lib/tdb/common/transaction.c @@ -321,6 +321,9 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, if (blk == tdb->transaction->num_blocks-1 && off + len > tdb->transaction->last_block_size) { + if (off >= tdb->transaction->last_block_size) { + return 0; + } len = tdb->transaction->last_block_size - off; } -- cgit From 77a2870186d3b10ea15ba5e001e7a703f0a5ccaf Mon Sep 17 00:00:00 2001 From: Amin Azez Date: Fri, 1 Feb 2008 16:19:36 +0000 Subject: Samba4 poor mans debug_ctx() DEBUG(), DEBUGADD() and friends can now use debug_ctx() in the formatting expressions again, e.g. DEBUG(5,("Guid failed to match: %s\n", GUID_string(debug_ctx(), r->guid))); Sadly it's done with macros (again) but when we need to save the 8 or 16 bytes of object code per DEBUG() expression we can do it the Samba 3 way with added thread-safety for Samba 4. That could save up to 200K, allowing 12 bytes for each occurrance of DEBUG... Signed-off-by: Amin Azez (This used to be commit 9781967542b00c279563d435aec72dac1e8c7e9a) --- source4/lib/util/debug.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/util/debug.h b/source4/lib/util/debug.h index 1895ed53ad..605628174a 100644 --- a/source4/lib/util/debug.h +++ b/source4/lib/util/debug.h @@ -41,13 +41,17 @@ struct debug_ops { extern int DEBUGLEVEL; +#define debug_ctx() (_debug_ctx?_debug_ctx:(_debug_ctx=talloc_new(NULL))) + #define DEBUGLVL(level) ((level) <= DEBUGLEVEL) #define _DEBUG(level, body, header) do { \ if (DEBUGLVL(level)) { \ + void* _debug_ctx=NULL; \ if (header) { \ do_debug_header(level, __location__, __FUNCTION__); \ } \ do_debug body; \ + talloc_free(_debug_ctx); \ } \ } while (0) /** -- cgit