diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-08-17 06:47:53 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-08-17 06:47:53 +0000 |
commit | 72ed7049d88e5296ebec362189e62a384385ad34 (patch) | |
tree | 4609523acc63ae3e14201b49a4b9c47d1ec8e4d6 /source3/lib | |
parent | 69c6f1624d79e4cf4296856d66216cca90863286 (diff) | |
download | samba-72ed7049d88e5296ebec362189e62a384385ad34.tar.gz samba-72ed7049d88e5296ebec362189e62a384385ad34.tar.bz2 samba-72ed7049d88e5296ebec362189e62a384385ad34.zip |
added some optimisation for the case where the number of open files is
very large. files.c now promotes a files_struct to the top of the list
if it is used when it is more than 10 elements from the top.
also moved common linked list code for the 5 sets of linked lists that
I've created over the past few days into dlinklist.h (I've explained
to Chris why I didn't use the ubiqx code)
(This used to be commit 1eb9ae2996b5a243a147f485e7e353d54f820852)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_hnd.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/source3/lib/util_hnd.c b/source3/lib/util_hnd.c index 2fc2c73ea3..d65116e646 100644 --- a/source3/lib/util_hnd.c +++ b/source3/lib/util_hnd.c @@ -124,14 +124,7 @@ BOOL open_lsa_policy_hnd(POLICY_HND *hnd) bitmap_set(bmap, i); - /* hook into the front of the list */ - if (!Policy) { - Policy = p; - } else { - Policy->prev = p; - p->next = Policy; - Policy = p; - } + DLIST_ADD(Policy, p); DEBUG(4,("Opened policy hnd[%x] ", i)); dump_data(4, (char *)hnd->data, sizeof(hnd->data)); @@ -303,13 +296,7 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd) DEBUG(3,("Closed policy name pnum=%x\n", p->pnum)); - if (p == Policy) { - Policy = p->next; - if (Policy) Policy->prev = NULL; - } else { - p->prev->next = p->next; - if (p->next) p->next->prev = p->prev; - } + DLIST_REMOVE(Policy, p); bitmap_clear(bmap, p->pnum); |