The branch, master has been updated
       via  ad3c0e0 talloc: Slightly simplify talloc_unlink
       via  0bee871 talloc: Fix a typo
      from  48804e4 Fix the build without kerberos

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


- Log -----------------------------------------------------------------
commit ad3c0e03e2e1178a707ec6c529108f1df71a47a4
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 2 14:56:04 2012 +0100

    talloc: Slightly simplify talloc_unlink
    
    Nested if's are hard to understand to me.
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    
    Autobuild-User: Volker Lendecke <[email protected]>
    Autobuild-Date: Mon Jan  2 19:07:23 CET 2012 on sn-devel-104

commit 0bee8719b2dffc98557b9b3d68bb589b5589f3a4
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 2 14:27:37 2012 +0100

    talloc: Fix a typo

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

Summary of changes:
 lib/talloc/talloc.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 2098a32..38e6f21 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -1043,7 +1043,7 @@ static inline int talloc_unreference(const void *context, 
const void *ptr)
 */
 _PUBLIC_ int talloc_unlink(const void *context, void *ptr)
 {
-       struct talloc_chunk *tc_p, *new_p;
+       struct talloc_chunk *tc_p, *new_p, *tc_c;
        void *new_parent;
 
        if (ptr == NULL) {
@@ -1058,14 +1058,13 @@ _PUBLIC_ int talloc_unlink(const void *context, void 
*ptr)
                return 0;
        }
 
-       if (context == NULL) {
-               if (talloc_parent_chunk(ptr) != NULL) {
-                       return -1;
-               }
+       if (context != NULL) {
+               tc_c = talloc_chunk_from_ptr(context);
        } else {
-               if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) 
{
-                       return -1;
-               }
+               tc_c = NULL;
+       }
+       if (tc_c != talloc_parent_chunk(ptr)) {
+               return -1;
        }
        
        tc_p = talloc_chunk_from_ptr(ptr);
@@ -1176,7 +1175,7 @@ _PUBLIC_ void *talloc_check_name(const void *ptr, const 
char *name)
        return NULL;
 }
 
-static void talloc_abort_type_missmatch(const char *location,
+static void talloc_abort_type_mismatch(const char *location,
                                        const char *name,
                                        const char *expected)
 {
@@ -1199,7 +1198,7 @@ _PUBLIC_ void *_talloc_get_type_abort(const void *ptr, 
const char *name, const c
        const char *pname;
 
        if (unlikely(ptr == NULL)) {
-               talloc_abort_type_missmatch(location, NULL, name);
+               talloc_abort_type_mismatch(location, NULL, name);
                return NULL;
        }
 
@@ -1208,7 +1207,7 @@ _PUBLIC_ void *_talloc_get_type_abort(const void *ptr, 
const char *name, const c
                return discard_const_p(void, ptr);
        }
 
-       talloc_abort_type_missmatch(location, pname, name);
+       talloc_abort_type_mismatch(location, pname, name);
        return NULL;
 }
 


-- 
Samba Shared Repository

Reply via email to