[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri May 16 11:52:04 MDT 2014


The branch, master has been updated
       via  b8e5b68 talloc: version 2.1.1
       via  8fbb819 talloc/tests: avoid some unused variable warnings
       via  de822b5 talloc: fix compiler warning
       via  eb95fc8 talloc: check for TALLOC_GET_TYPE_ABORT_NOOP
       via  b9fcfc6 talloc: avoid a function call in TALLOC_FREE() if possible.
       via  014eecd talloc: inline talloc_get_name()
       via  3aa3535 talloc: inline more static functions
      from  f27d8b8 lib: Fix build --without-winbind by adding winbind_lookup_usersids dummy

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b8e5b68de3cff8d16e4be07fdc2e780d2c3c5750
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 15 14:53:49 2014 +0200

    talloc: version 2.1.1
    
    Changes:
    - documentation updates
    - a fix for pytalloc-util.pc
    - performance improvements here and there
    - fixed compiler warnings
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Fri May 16 19:51:26 CEST 2014 on sn-devel-104

commit 8fbb81923ddf3449b4ad1fa1a562c9fab8c74103
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 27 09:28:02 2014 +0100

    talloc/tests: avoid some unused variable warnings
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit de822b58476093dc43c27577d2f7074541113cc5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Nov 20 09:58:09 2013 +0100

    talloc: fix compiler warning
    
    This avoids the following warning when using:
    
    CFLAGS="-O3 -g -fstrict-overflow -Wstrict-overflow=5"
    
    ../talloc.c: In Funktion »talloc_is_parent«:
    ../talloc.c:2658:21: Warnung: assuming signed overflow does not occur when
    changing X +- C1 cmp C2 to X cmp C1 +- C2 [-Wstrict-overflow]
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit eb95fc8866dd1710b4cc2f4a4e1dc9867424def2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Dec 5 08:36:13 2013 +0100

    talloc: check for TALLOC_GET_TYPE_ABORT_NOOP
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b9fcfc6399eab750880ee0b9806311dd351a8ff6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 4 15:35:37 2013 +0100

    talloc: avoid a function call in TALLOC_FREE() if possible.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 014eecd0b2aead3a160af0d864feddd53c85b580
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 4 23:22:04 2013 +0100

    talloc: inline talloc_get_name()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3aa35354724b88acc63f6b4439f7203d10db4e90
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Nov 20 09:57:58 2013 +0100

    talloc: inline more static functions
    
    We need the code to be as fast as possible.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 .../talloc/ABI/pytalloc-util-2.1.1.sigs            |    0
 .../ABI/{talloc-2.1.0.sigs => talloc-2.1.1.sigs}   |    0
 lib/talloc/talloc.c                                |   66 ++++++++++++--------
 lib/talloc/talloc.h                                |    6 ++-
 lib/talloc/testsuite.c                             |   13 ++++
 lib/talloc/wscript                                 |    2 +-
 6 files changed, 59 insertions(+), 28 deletions(-)
 copy ctdb/lib/talloc/ABI/pytalloc-util-2.0.6.sigs => lib/talloc/ABI/pytalloc-util-2.1.1.sigs (100%)
 copy lib/talloc/ABI/{talloc-2.1.0.sigs => talloc-2.1.1.sigs} (100%)


Changeset truncated at 500 lines:

diff --git a/ctdb/lib/talloc/ABI/pytalloc-util-2.0.6.sigs b/lib/talloc/ABI/pytalloc-util-2.1.1.sigs
similarity index 100%
copy from ctdb/lib/talloc/ABI/pytalloc-util-2.0.6.sigs
copy to lib/talloc/ABI/pytalloc-util-2.1.1.sigs
diff --git a/lib/talloc/ABI/talloc-2.1.0.sigs b/lib/talloc/ABI/talloc-2.1.1.sigs
similarity index 100%
copy from lib/talloc/ABI/talloc-2.1.0.sigs
copy to lib/talloc/ABI/talloc-2.1.1.sigs
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 2a5406e..fa56ea5 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -235,12 +235,14 @@ struct talloc_memlimit {
 	size_t cur_size;
 };
 
-static bool talloc_memlimit_check(struct talloc_memlimit *limit, size_t size);
-static void talloc_memlimit_grow(struct talloc_memlimit *limit,
+static inline bool talloc_memlimit_check(struct talloc_memlimit *limit, size_t size);
+static inline void talloc_memlimit_grow(struct talloc_memlimit *limit,
 				size_t size);
-static void talloc_memlimit_shrink(struct talloc_memlimit *limit,
+static inline void talloc_memlimit_shrink(struct talloc_memlimit *limit,
 				size_t size);
-static void talloc_memlimit_update_on_free(struct talloc_chunk *tc);
+static inline void talloc_memlimit_update_on_free(struct talloc_chunk *tc);
+
+static inline void _talloc_set_name_const(const void *ptr, const char *name);
 
 typedef int (*talloc_destructor_t)(void *);
 
@@ -466,41 +468,41 @@ struct talloc_pool_hdr {
 
 #define TP_HDR_SIZE TC_ALIGN16(sizeof(struct talloc_pool_hdr))
 
-static struct talloc_pool_hdr *talloc_pool_from_chunk(struct talloc_chunk *c)
+static inline struct talloc_pool_hdr *talloc_pool_from_chunk(struct talloc_chunk *c)
 {
 	return (struct talloc_pool_hdr *)((char *)c - TP_HDR_SIZE);
 }
 
-static struct talloc_chunk *talloc_chunk_from_pool(struct talloc_pool_hdr *h)
+static inline struct talloc_chunk *talloc_chunk_from_pool(struct talloc_pool_hdr *h)
 {
 	return (struct talloc_chunk *)((char *)h + TP_HDR_SIZE);
 }
 
-static void *tc_pool_end(struct talloc_pool_hdr *pool_hdr)
+static inline void *tc_pool_end(struct talloc_pool_hdr *pool_hdr)
 {
 	struct talloc_chunk *tc = talloc_chunk_from_pool(pool_hdr);
 	return (char *)tc + TC_HDR_SIZE + pool_hdr->poolsize;
 }
 
-static size_t tc_pool_space_left(struct talloc_pool_hdr *pool_hdr)
+static inline size_t tc_pool_space_left(struct talloc_pool_hdr *pool_hdr)
 {
 	return (char *)tc_pool_end(pool_hdr) - (char *)pool_hdr->end;
 }
 
 /* If tc is inside a pool, this gives the next neighbour. */
-static void *tc_next_chunk(struct talloc_chunk *tc)
+static inline void *tc_next_chunk(struct talloc_chunk *tc)
 {
 	return (char *)tc + TC_ALIGN16(TC_HDR_SIZE + tc->size);
 }
 
-static void *tc_pool_first_chunk(struct talloc_pool_hdr *pool_hdr)
+static inline void *tc_pool_first_chunk(struct talloc_pool_hdr *pool_hdr)
 {
 	struct talloc_chunk *tc = talloc_chunk_from_pool(pool_hdr);
 	return tc_next_chunk(tc);
 }
 
 /* Mark the whole remaining pool as not accessable */
-static void tc_invalidate_pool(struct talloc_pool_hdr *pool_hdr)
+static inline void tc_invalidate_pool(struct talloc_pool_hdr *pool_hdr)
 {
 	size_t flen = tc_pool_space_left(pool_hdr);
 
@@ -517,8 +519,8 @@ static void tc_invalidate_pool(struct talloc_pool_hdr *pool_hdr)
   Allocate from a pool
 */
 
-static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent,
-					      size_t size, size_t prefix_len)
+static inline struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent,
+						     size_t size, size_t prefix_len)
 {
 	struct talloc_pool_hdr *pool_hdr = NULL;
 	size_t space_left;
@@ -657,7 +659,7 @@ static inline void *__talloc(const void *context, size_t size)
  * Create a talloc pool
  */
 
-_PUBLIC_ void *talloc_pool(const void *context, size_t size)
+static inline void *_talloc_pool(const void *context, size_t size)
 {
 	struct talloc_chunk *tc;
 	struct talloc_pool_hdr *pool_hdr;
@@ -684,6 +686,11 @@ _PUBLIC_ void *talloc_pool(const void *context, size_t size)
 	return result;
 }
 
+_PUBLIC_ void *talloc_pool(const void *context, size_t size)
+{
+	return _talloc_pool(context, size);
+}
+
 /*
  * Create a talloc pool correctly sized for a basic size plus
  * a number of subobjects whose total size is given. Essentially
@@ -727,7 +734,7 @@ _PUBLIC_ void *_talloc_pooled_object(const void *ctx,
 	}
 	poolsize = tmp;
 
-	ret = talloc_pool(ctx, poolsize);
+	ret = _talloc_pool(ctx, poolsize);
 	if (ret == NULL) {
 		return NULL;
 	}
@@ -743,7 +750,7 @@ _PUBLIC_ void *_talloc_pooled_object(const void *ctx,
 
 	pool_hdr->end = ((char *)pool_hdr->end + TC_ALIGN16(type_size));
 
-	talloc_set_name_const(ret, type_name);
+	_talloc_set_name_const(ret, type_name);
 	return ret;
 
 overflow:
@@ -1348,7 +1355,7 @@ _PUBLIC_ void *talloc_named(const void *context, size_t size, const char *fmt, .
 /*
   return the name of a talloc ptr, or "UNNAMED"
 */
-_PUBLIC_ const char *talloc_get_name(const void *ptr)
+static inline const char *__talloc_get_name(const void *ptr)
 {
 	struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
 	if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) {
@@ -1360,6 +1367,10 @@ _PUBLIC_ const char *talloc_get_name(const void *ptr)
 	return "UNNAMED";
 }
 
+_PUBLIC_ const char *talloc_get_name(const void *ptr)
+{
+	return __talloc_get_name(ptr);
+}
 
 /*
   check if a pointer has the given name. If it does, return the pointer,
@@ -1369,7 +1380,7 @@ _PUBLIC_ void *talloc_check_name(const void *ptr, const char *name)
 {
 	const char *pname;
 	if (unlikely(ptr == NULL)) return NULL;
-	pname = talloc_get_name(ptr);
+	pname = __talloc_get_name(ptr);
 	if (likely(pname == name || strcmp(pname, name) == 0)) {
 		return discard_const_p(void, ptr);
 	}
@@ -1403,7 +1414,7 @@ _PUBLIC_ void *_talloc_get_type_abort(const void *ptr, const char *name, const c
 		return NULL;
 	}
 
-	pname = talloc_get_name(ptr);
+	pname = __talloc_get_name(ptr);
 	if (likely(pname == name || strcmp(pname, name) == 0)) {
 		return discard_const_p(void, ptr);
 	}
@@ -1858,7 +1869,7 @@ enum talloc_mem_count_type {
 	TOTAL_MEM_LIMIT,
 };
 
-static size_t _talloc_total_mem_internal(const void *ptr,
+static inline size_t _talloc_total_mem_internal(const void *ptr,
 					 enum talloc_mem_count_type type,
 					 struct talloc_memlimit *old_limit,
 					 struct talloc_memlimit *new_limit)
@@ -2021,7 +2032,7 @@ _PUBLIC_ void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
 
 static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f)
 {
-	const char *name = talloc_get_name(ptr);
+	const char *name = __talloc_get_name(ptr);
 	struct talloc_chunk *tc;
 	FILE *f = (FILE *)_f;
 
@@ -2621,9 +2632,9 @@ _PUBLIC_ void talloc_show_parents(const void *context, FILE *file)
 	}
 
 	tc = talloc_chunk_from_ptr(context);
-	fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context));
+	fprintf(file, "talloc parents of '%s'\n", __talloc_get_name(context));
 	while (tc) {
-		fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc)));
+		fprintf(file, "\t'%s'\n", __talloc_get_name(TC_PTR_FROM_CHUNK(tc)));
 		while (tc && tc->prev) tc = tc->prev;
 		if (tc) {
 			tc = tc->parent;
@@ -2644,7 +2655,10 @@ static int _talloc_is_parent(const void *context, const void *ptr, int depth)
 	}
 
 	tc = talloc_chunk_from_ptr(context);
-	while (tc && depth > 0) {
+	while (tc) {
+		if (depth <= 0) {
+			return 0;
+		}
 		if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1;
 		while (tc && tc->prev) tc = tc->prev;
 		if (tc) {
@@ -2666,7 +2680,7 @@ _PUBLIC_ int talloc_is_parent(const void *context, const void *ptr)
 /*
   return the total size of memory used by this context and all children
 */
-static size_t _talloc_total_limit_size(const void *ptr,
+static inline size_t _talloc_total_limit_size(const void *ptr,
 					struct talloc_memlimit *old_limit,
 					struct talloc_memlimit *new_limit)
 {
@@ -2674,7 +2688,7 @@ static size_t _talloc_total_limit_size(const void *ptr,
 					  old_limit, new_limit);
 }
 
-static bool talloc_memlimit_check(struct talloc_memlimit *limit, size_t size)
+static inline bool talloc_memlimit_check(struct talloc_memlimit *limit, size_t size)
 {
 	struct talloc_memlimit *l;
 
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index 5d29a8d..5ece54d 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -761,7 +761,11 @@ type *talloc_get_type(const void *ptr, #type);
  */
 void *talloc_get_type_abort(const void *ptr, #type);
 #else
+#ifdef TALLOC_GET_TYPE_ABORT_NOOP
+#define talloc_get_type_abort(ptr, type) (type *)(ptr)
+#else
 #define talloc_get_type_abort(ptr, type) (type *)_talloc_get_type_abort(ptr, #type, __location__)
+#endif
 void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location);
 #endif
 
@@ -893,7 +897,7 @@ void *_talloc_pooled_object(const void *ctx,
  *
  * @param[in]  ctx      The chunk to be freed.
  */
-#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0)
+#define TALLOC_FREE(ctx) do { if (ctx != NULL) { talloc_free(ctx); ctx=NULL; } } while(0)
 
 /* @} ******************************************************************/
 
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index 888d260..a878278 100644
--- a/lib/talloc/testsuite.c
+++ b/lib/talloc/testsuite.c
@@ -141,6 +141,7 @@ static bool test_ref1(void)
 
 	CHECK_BLOCKS("ref1", p1, 5);
 	CHECK_BLOCKS("ref1", p2, 1);
+	CHECK_BLOCKS("ref1", ref, 1);
 	CHECK_BLOCKS("ref1", r1, 2);
 
 	fprintf(stderr, "Freeing p2\n");
@@ -249,6 +250,7 @@ static bool test_ref3(void)
 	CHECK_BLOCKS("ref3", p1, 2);
 	CHECK_BLOCKS("ref3", p2, 2);
 	CHECK_BLOCKS("ref3", r1, 1);
+	CHECK_BLOCKS("ref3", ref, 1);
 
 	fprintf(stderr, "Freeing p1\n");
 	talloc_free(p1);
@@ -291,6 +293,7 @@ static bool test_ref4(void)
 
 	CHECK_BLOCKS("ref4", p1, 5);
 	CHECK_BLOCKS("ref4", p2, 1);
+	CHECK_BLOCKS("ref4", ref, 1);
 	CHECK_BLOCKS("ref4", r1, 2);
 
 	fprintf(stderr, "Freeing r1\n");
@@ -341,6 +344,7 @@ static bool test_unlink1(void)
 
 	CHECK_BLOCKS("unlink", p1, 7);
 	CHECK_BLOCKS("unlink", p2, 1);
+	CHECK_BLOCKS("unlink", ref, 1);
 	CHECK_BLOCKS("unlink", r1, 2);
 
 	fprintf(stderr, "Unreferencing r1\n");
@@ -409,6 +413,8 @@ static bool test_misc(void)
 	name = talloc_set_name(p1, "my name is %s", "foo");
 	torture_assert_str_equal("misc", talloc_get_name(p1), "my name is foo",
 		"failed: wrong name after talloc_set_name(my name is foo)");
+	torture_assert_str_equal("misc", talloc_get_name(p1), name,
+		"failed: wrong name after talloc_set_name(my name is foo)");
 	CHECK_BLOCKS("misc", p1, 2);
 	CHECK_BLOCKS("misc", root, 3);
 
@@ -617,6 +623,7 @@ static bool test_realloc_child(void)
 	el2 = talloc(el1->list, struct el2);
 	el2 = talloc(el1->list2, struct el2);
 	el2 = talloc(el1->list3, struct el2);
+	(void)el2;
 
 	el1->list = talloc_realloc(el1, el1->list, struct el2 *, 100);
 	el1->list2 = talloc_realloc(el1, el1->list2, struct el2 *, 200);
@@ -829,6 +836,8 @@ static bool test_speed(void)
 			p1 = talloc_size(ctx, loop % 100);
 			p2 = talloc_strdup(p1, "foo bar");
 			p3 = talloc_size(p1, 300);
+			(void)p2;
+			(void)p3;
 			talloc_free(p1);
 		}
 		count += 3 * loop;
@@ -848,6 +857,8 @@ static bool test_speed(void)
 			p1 = talloc_size(ctx, loop % 100);
 			p2 = talloc_strdup(p1, "foo bar");
 			p3 = talloc_size(p1, 300);
+			(void)p2;
+			(void)p3;
 			talloc_free(p1);
 		}
 		count += 3 * loop;
@@ -1380,6 +1391,7 @@ static bool test_free_children(void)
 	root = talloc_new(NULL);
 	p1 = talloc_strdup(root, "foo1");
 	p2 = talloc_strdup(p1, "foo2");
+	(void)p2;
 
 	talloc_set_name(p1, "%s", "testname");
 	talloc_free_children(p1);
@@ -1404,6 +1416,7 @@ static bool test_free_children(void)
 	name2 = talloc_get_name(p1);
 	/* but this does */
 	talloc_free_children(p1);
+	(void)name2;
 	torture_assert("namecheck", strcmp(talloc_get_name(p1), "testname2") == 0,
 		       "wrong name");
 	CHECK_BLOCKS("name1", p1, 1);
diff --git a/lib/talloc/wscript b/lib/talloc/wscript
index 1ca41f6..9df64d9 100644
--- a/lib/talloc/wscript
+++ b/lib/talloc/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'talloc'
-VERSION = '2.1.0'
+VERSION = '2.1.1'
 
 
 blddir = 'bin'


-- 
Samba Shared Repository


More information about the samba-cvs mailing list