r18605: sync dlinklist.h with samba4, that means DLIST_ADD_END()
authorStefan Metzmacher <metze@samba.org>
Mon, 18 Sep 2006 07:52:16 +0000 (07:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:51:59 +0000 (11:51 -0500)
and DLIST_DEMOTE() now take the type of the tmp pointer
not the tmp pointer itself anymore.

metze
(This used to be commit 2f58645b7094e81dff3734f11aa183ea2ab53d2d)

14 files changed:
source3/auth/auth.c
source3/include/dlinklist.h
source3/lib/smbldap.c
source3/libsmb/cliconnect.c
source3/nmbd/nmbd_browserdb.c
source3/nsswitch/winbindd_dual.c
source3/printing/notify.c
source3/registry/regfio.c
source3/smbd/blocking.c
source3/smbd/nttrans.c
source3/smbd/posix_acls.c
source3/smbd/process.c
source3/smbd/trans2.c
source3/tdb/common/tdbutil.c

index 139ba5482b748226d0f6b54acef0b1c6d0a60c51..0b868b265ed7ecd00641dd7c0742f3679aff791d 100644 (file)
@@ -432,7 +432,6 @@ static NTSTATUS make_auth_context_text_list(struct auth_context **auth_context,
 {
        auth_methods *list = NULL;
        auth_methods *t = NULL;
-       auth_methods *tmp;
        NTSTATUS nt_status;
 
        if (!text_list) {
@@ -445,7 +444,7 @@ static NTSTATUS make_auth_context_text_list(struct auth_context **auth_context,
 
        for (;*text_list; text_list++) { 
                if (load_auth_module(*auth_context, *text_list, &t)) {
-                   DLIST_ADD_END(list, t, tmp);
+                   DLIST_ADD_END(list, t, auth_methods *);
                }
        }
        
index daec7640e40e1c7abc8182e9ab772f5ce4390a69..f267e77ea6dee174a4b917bccfd8127be2335757 100644 (file)
 /* To use these macros you must have a structure containing a next and
    prev pointer */
 
+#ifndef _DLINKLIST_H
+#define _DLINKLIST_H
+
 
 /* hook into the front of the list */
 #define DLIST_ADD(list, p) \
-{ \
+do { \
         if (!(list)) { \
                (list) = (p); \
                (p)->next = (p)->prev = NULL; \
                (p)->prev = NULL; \
                (list) = (p); \
        }\
-}
+} while (0)
 
 /* remove an element from a list - element doesn't have to be in list. */
 #define DLIST_REMOVE(list, p) \
-{ \
+do { \
        if ((p) == (list)) { \
                (list) = (p)->next; \
                if (list) (list)->prev = NULL; \
                if ((p)->next) (p)->next->prev = (p)->prev; \
        } \
        if ((p) != (list)) (p)->next = (p)->prev = NULL; \
-}
+} while (0)
 
 /* promote an element to the top of the list */
 #define DLIST_PROMOTE(list, p) \
-{ \
-          DLIST_REMOVE(list, p) \
-          DLIST_ADD(list, p) \
-}
+do { \
+          DLIST_REMOVE(list, p); \
+          DLIST_ADD(list, p); \
+} while (0)
 
 /* hook into the end of the list - needs a tmp pointer */
-#define DLIST_ADD_END(list, p, tmp) \
-{ \
+#define DLIST_ADD_END(list, p, type) \
+do { \
                if (!(list)) { \
                        (list) = (p); \
                        (p)->next = (p)->prev = NULL; \
                } else { \
-                       for ((tmp) = (list); (tmp)->next; (tmp) = (tmp)->next) ; \
-                       (tmp)->next = (p); \
+                       type tmp; \
+                       for (tmp = (list); tmp->next; tmp = tmp->next) ; \
+                       tmp->next = (p); \
                        (p)->next = NULL; \
-                       (p)->prev = (tmp); \
+                       (p)->prev = tmp; \
                } \
-}
+} while (0)
 
 /* insert 'p' after the given element 'el' in a list. If el is NULL then
    this is the same as a DLIST_ADD() */
@@ -84,9 +88,27 @@ do { \
        }\
 } while (0)
 
-/* demote an element to the top of the list, needs a tmp pointer */
+/* demote an element to the end of the list, needs a tmp pointer */
 #define DLIST_DEMOTE(list, p, tmp) \
-{ \
-               DLIST_REMOVE(list, p) \
-               DLIST_ADD_END(list, p, tmp) \
-}
+do { \
+               DLIST_REMOVE(list, p); \
+               DLIST_ADD_END(list, p, tmp); \
+} while (0)
+
+/* concatenate two lists - putting all elements of the 2nd list at the
+   end of the first list */
+#define DLIST_CONCATENATE(list1, list2, type) \
+do { \
+               if (!(list1)) { \
+                       (list1) = (list2); \
+               } else { \
+                       type tmp; \
+                       for (tmp = (list1); tmp->next; tmp = tmp->next) ; \
+                       tmp->next = (list2); \
+                       if (list2) { \
+                               (list2)->prev = tmp;    \
+                       } \
+               } \
+} while (0)
+
+#endif /* _DLINKLIST_H */
index b46ab4d750b48a870adb801e2bd9c4829d58661c..85dd5fa3d67c15877f57e35359bb47e14f6e4880 100644 (file)
@@ -572,7 +572,6 @@ static void smbldap_store_state(LDAP *ld, struct smbldap_state *smbldap_state)
 {
        struct smbldap_state *tmp_ldap_state;
        struct smbldap_state_lookup *t;
-       struct smbldap_state_lookup *tmp;
        
        if ((tmp_ldap_state = smbldap_find_state(ld))) {
                SMB_ASSERT(tmp_ldap_state == smbldap_state);
@@ -582,7 +581,7 @@ static void smbldap_store_state(LDAP *ld, struct smbldap_state *smbldap_state)
        t = SMB_XMALLOC_P(struct smbldap_state_lookup);
        ZERO_STRUCTP(t);
        
-       DLIST_ADD_END(smbldap_state_lookup_list, t, tmp);
+       DLIST_ADD_END(smbldap_state_lookup_list, t, struct smbldap_state_lookup *);
        t->ld = ld;
        t->smbldap_state = smbldap_state;
 }
index 0e179416dc7c596e9c65e91f8345a7dc7519655c..cdc22293cb576513df25f3ad4dfa5b79e8a34f62 100644 (file)
@@ -1423,7 +1423,7 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli,
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       cli_set_timeout(cli, 10000); /* 10 seconds. */
+       cli_set_timeout(cli, 30000); /* 10 seconds. */
 
        if (dest_ip)
                ip = *dest_ip;
index e27e483702a2a4d67594d48ce35bd1bde3850190..b75028be0dbe843d00e7146137825f1b4d9e779c 100644 (file)
@@ -86,7 +86,6 @@ struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
                                                          struct in_addr ip )
 {
        struct browse_cache_record *browc;
-       struct browse_cache_record *tmp_browc;
        time_t now = time( NULL );
 
        browc = SMB_MALLOC_P(struct browse_cache_record);
@@ -115,7 +114,7 @@ struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
   
        browc->ip = ip;
  
-       DLIST_ADD_END(lmb_browserlist, browc, tmp_browc);
+       DLIST_ADD_END(lmb_browserlist, browc, struct browse_cache_record *);
 
        if( DEBUGLVL( 3 ) ) {
                Debug1( "nmbd_browserdb:create_browser_in_lmb_cache()\n" );
index e2e0db857008c75e9e71d76c3f2d69d8ff9ed709..128c468dd3d2f660259c0da4b5a52cec88000aa6 100644 (file)
@@ -108,7 +108,7 @@ void async_request(TALLOC_CTX *mem_ctx, struct winbindd_child *child,
                   void (*continuation)(void *private_data, BOOL success),
                   void *private_data)
 {
-       struct winbindd_async_request *state, *tmp;
+       struct winbindd_async_request *state;
 
        SMB_ASSERT(continuation != NULL);
 
@@ -127,7 +127,7 @@ void async_request(TALLOC_CTX *mem_ctx, struct winbindd_child *child,
        state->continuation = continuation;
        state->private_data = private_data;
 
-       DLIST_ADD_END(child->requests, state, tmp);
+       DLIST_ADD_END(child->requests, state, struct winbindd_async_request *);
 
        schedule_async_request(child);
 
index 916ff213cc50c2491eb6a621a30d80305aedb899..7d5b70278192b527f8871843e685cb2e42a7848e 100644 (file)
@@ -295,7 +295,7 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer));
         * the messages are sent in the order they were received. JRA.
         */
 
-       DLIST_ADD_END(notify_queue_head, pnqueue, tmp_ptr);
+       DLIST_ADD_END(notify_queue_head, pnqueue, struct notify_queue *);
        num_messages++;
 }
 
index 768255a9faae23c1744257cc36975e3c44fec89d..f2e95da8898025cb7f39ae6b750ca98e5e020f22 100644 (file)
@@ -1748,7 +1748,6 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
        if ( sec_desc ) {
                uint32 sk_size = sk_record_data_size( sec_desc );
                REGF_HBIN *sk_hbin;
-               REGF_SK_REC *tmp = NULL;
 
                /* search for it in the existing list of sd's */
 
@@ -1777,7 +1776,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
                        /* size value must be self-inclusive */
                        nk->sec_desc->size      = sec_desc_size(sec_desc) + sizeof(uint32);
 
-                       DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, tmp );
+                       DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, REGF_SK_REC *);
 
                        /* update the offsets for us and the previous sd in the list.
                           if this is the first record, then just set the next and prev
index 2f89759ffd1eca91115876d678e6db79c9741928..f489a8e96b2bf41f0c7a951ff091ceba3e420787 100644 (file)
@@ -86,7 +86,7 @@ BOOL push_blocking_lock_request( struct byte_range_lock *br_lck,
                SMB_BIG_UINT offset, SMB_BIG_UINT count)
 {
        static BOOL set_lock_msg;
-       blocking_lock_record *blr, *tmp;
+       blocking_lock_record *blr;
        NTSTATUS status;
 
        if(in_chained_smb() ) {
@@ -148,7 +148,7 @@ BOOL push_blocking_lock_request( struct byte_range_lock *br_lck,
                return False;
        }
 
-       DLIST_ADD_END(blocking_lock_queue, blr, tmp);
+       DLIST_ADD_END(blocking_lock_queue, blr, blocking_lock_record *);
 
        /* Ensure we'll receive messages when this is unlocked. */
        if (!set_lock_msg) {
index 4dcc807c30c5974f84f1086c902378081df580ec..c5e48a6324a91a7dd558fbc4576d6f69c368b851 100644 (file)
@@ -1049,14 +1049,13 @@ static struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata,
 
        while (offset + 4 <= data_size) {
                size_t next_offset = IVAL(pdata,offset);
-               struct ea_list *tmp;
                struct ea_list *eal = read_ea_list_entry(ctx, pdata + offset + 4, data_size - offset - 4, NULL);
 
                if (!eal) {
                        return NULL;
                }
 
-               DLIST_ADD_END(ea_list_head, eal, tmp);
+               DLIST_ADD_END(ea_list_head, eal, struct ea_list *);
                if (next_offset == 0) {
                        break;
                }
index a1903ef4bbfcf326c426384bf25e6add6b19f9dc..18ef187f382820ef1753fe6d0b9f7b9e6b30b47e 100644 (file)
@@ -1241,7 +1241,6 @@ static BOOL create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst,
        BOOL all_aces_are_inherit_only = (fsp->is_directory ? True : False);
        canon_ace *file_ace = NULL;
        canon_ace *dir_ace = NULL;
-       canon_ace *tmp_ace = NULL;
        canon_ace *current_ace = NULL;
        BOOL got_dir_allow = False;
        BOOL got_file_allow = False;
@@ -1429,7 +1428,7 @@ static BOOL create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst,
                        if ((psa->flags & (SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT)) ==
                                (SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT)) {
 
-                               DLIST_ADD_END(dir_ace, current_ace, tmp_ace);
+                               DLIST_ADD_END(dir_ace, current_ace, canon_ace *);
 
                                /*
                                 * Note if this was an allow ace. We can't process
@@ -1487,7 +1486,7 @@ Deny entry after Allow entry. Failing to set on file %s.\n", fsp->fsp_name ));
                 */
 
                if (current_ace && !(psa->flags & SEC_ACE_FLAG_INHERIT_ONLY)) {
-                       DLIST_ADD_END(file_ace, current_ace, tmp_ace);
+                       DLIST_ADD_END(file_ace, current_ace, canon_ace *);
 
                        /*
                         * Note if this was an allow ace. We can't process
@@ -1734,7 +1733,6 @@ static void process_deny_list( canon_ace **pp_ace_list )
        for (curr_ace = ace_list; curr_ace; curr_ace = curr_ace_next) {
                mode_t new_perms = (mode_t)0;
                canon_ace *allow_ace_p;
-               canon_ace *tmp_ace;
 
                curr_ace_next = curr_ace->next; /* So we can't lose the link. */
 
@@ -1753,7 +1751,7 @@ static void process_deny_list( canon_ace **pp_ace_list )
 
                        curr_ace->attr = ALLOW_ACE;
                        curr_ace->perms = (mode_t)0;
-                       DLIST_DEMOTE(ace_list, curr_ace, tmp_ace);
+                       DLIST_DEMOTE(ace_list, curr_ace, canon_ace *);
                        continue;
                }
 
@@ -1778,13 +1776,12 @@ static void process_deny_list( canon_ace **pp_ace_list )
 
                curr_ace->attr = ALLOW_ACE;
                curr_ace->perms = (new_perms & ~curr_ace->perms);
-               DLIST_DEMOTE(ace_list, curr_ace, tmp_ace);
+               DLIST_DEMOTE(ace_list, curr_ace, canon_ace *);
        }
 
        /* Pass 3 above - deal with deny group entries. */
 
        for (curr_ace = ace_list; curr_ace; curr_ace = curr_ace_next) {
-               canon_ace *tmp_ace;
                canon_ace *allow_ace_p;
                canon_ace *allow_everyone_p = NULL;
 
@@ -1826,8 +1823,7 @@ static void process_deny_list( canon_ace **pp_ace_list )
                        curr_ace->perms = allow_everyone_p->perms & ~curr_ace->perms;
                else
                        curr_ace->perms = (mode_t)0;
-               DLIST_DEMOTE(ace_list, curr_ace, tmp_ace);
-
+               DLIST_DEMOTE(ace_list, curr_ace, canon_ace *);
        }
 
        /* Doing this fourth pass allows Windows semantics to be layered
@@ -2067,7 +2063,7 @@ static void arrange_posix_perms( char *filename, canon_ace **pp_list_head)
        }
 
        if (other_ace) {
-               DLIST_DEMOTE(list_head, other_ace, ace);
+               DLIST_DEMOTE(list_head, other_ace, canon_ace *);
        }
 
        /* We have probably changed the head of the list. */
index a202c1fa87a131c5bd2821722cf519a7ebee7bfd..cf61e16a15740f0d7b2275deb87a4782005ac396 100644 (file)
@@ -75,7 +75,6 @@ static BOOL push_queued_message(char *buf, int msg_len,
                                struct timeval end_time,
                                char *private_data, size_t private_len)
 {
-       struct pending_message_list *tmp_msg;
        struct pending_message_list *msg;
 
        msg = TALLOC_ZERO_P(NULL, struct pending_message_list);
@@ -105,7 +104,7 @@ static BOOL push_queued_message(char *buf, int msg_len,
                }
        }
 
-       DLIST_ADD_END(deferred_open_queue, msg, tmp_msg);
+       DLIST_ADD_END(deferred_open_queue, msg, struct pending_message_list *);
 
        DEBUG(10,("push_message: pushed message length %u on "
                  "deferred_open_queue\n", (unsigned int)msg_len));
index adbba92ee73158a7817f02361c195a0e5d2b4894..f2f0150f6f8b303b47767c83185227065416bfe0 100644 (file)
@@ -197,7 +197,7 @@ static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_str
 
        if (sizeret) {
                for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p) + 1) {
-                       struct ea_list *listp, *tmp;
+                       struct ea_list *listp;
 
                        if (strnequal(p, "system.", 7) || samba_private_attr_name(p))
                                continue;
@@ -218,7 +218,7 @@ static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_str
                                        (unsigned int)*pea_total_len, dos_ea_name,
                                        (unsigned int)listp->ea.value.length ));
                        }
-                       DLIST_ADD_END(ea_list_head, listp, tmp);
+                       DLIST_ADD_END(ea_list_head, listp, struct ea_list *);
                }
                /* Add on 4 for total length. */
                if (*pea_total_len) {
@@ -396,7 +396,6 @@ static struct ea_list *read_ea_name_list(TALLOC_CTX *ctx, const char *pdata, siz
        size_t offset = 0;
 
        while (offset + 2 < data_size) {
-               struct ea_list *tmp;
                struct ea_list *eal = TALLOC_ZERO_P(ctx, struct ea_list);
                unsigned int namelen = CVAL(pdata,offset);
 
@@ -418,7 +417,7 @@ static struct ea_list *read_ea_name_list(TALLOC_CTX *ctx, const char *pdata, siz
                }
 
                offset += (namelen + 1); /* Go past the name + terminating zero. */
-               DLIST_ADD_END(ea_list_head, eal, tmp);
+               DLIST_ADD_END(ea_list_head, eal, struct ea_list *);
                DEBUG(10,("read_ea_name_list: read ea name %s\n", eal->ea.name));
        }
 
@@ -493,14 +492,13 @@ static struct ea_list *read_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t d
        size_t bytes_used = 0;
 
        while (offset < data_size) {
-               struct ea_list *tmp;
                struct ea_list *eal = read_ea_list_entry(ctx, pdata + offset, data_size - offset, &bytes_used);
 
                if (!eal) {
                        return NULL;
                }
 
-               DLIST_ADD_END(ea_list_head, eal, tmp);
+               DLIST_ADD_END(ea_list_head, eal, struct ea_list *);
                offset += bytes_used;
        }
 
index b946f856aad7ca6c439486cda147447b7a1d4d05..45e18913241bbefd7b1eb638849605e64750f3e9 100644 (file)
@@ -720,7 +720,6 @@ TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern)
        TDB_DATA key, next;
        TDB_LIST_NODE *list = NULL;
        TDB_LIST_NODE *rec = NULL;
-       TDB_LIST_NODE *tmp = NULL;
        
        for (key = tdb_firstkey(tdb); key.dptr; key = next) {
                /* duplicate key string to ensure null-termination */
@@ -741,7 +740,7 @@ TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern)
 
                        rec->node_key = key;
        
-                       DLIST_ADD_END(list, rec, tmp);
+                       DLIST_ADD_END(list, rec, TDB_LIST_NODE *);
                
                        DEBUG(18, ("checking %s matched pattern %s\n", key_str, pattern));
                } else {