diff options
author | sueloverso <sue@mongodb.com> | 2015-08-13 09:28:53 -0400 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-14 16:54:47 +1000 |
commit | e8e1050c4f9cc6295f45949cfac8eeef2b9c1f43 (patch) | |
tree | 3f8b87f9636eb639187e73be6c881173eb11b5fc | |
parent | 5167870ac7e1ab1d46af3af9eb54b91ee04b2735 (diff) | |
download | mongo-e8e1050c4f9cc6295f45949cfac8eeef2b9c1f43.tar.gz |
Merge pull request #2119 from wiredtiger/tailq-simplify
Minor cleanups to tailq use, s_define searching.
(cherry picked from commit f12c69449d832488b8079aff9d1f4459dd34649d)
-rw-r--r-- | dist/s_define | 15 | ||||
-rw-r--r-- | dist/s_define.list | 60 | ||||
-rw-r--r-- | src/lsm/lsm_manager.c | 14 | ||||
-rw-r--r-- | src/txn/txn_nsnap.c | 4 |
4 files changed, 15 insertions, 78 deletions
diff --git a/dist/s_define b/dist/s_define index 7809bf14918..77673bdcdf9 100644 --- a/dist/s_define +++ b/dist/s_define @@ -4,18 +4,23 @@ t=__wt.$$ trap 'rm -f $t; exit 0' 0 1 2 3 13 15 -# List of files to search. +# List of source files to search. l=`sed -e 's,#.*,,' -e '/^$/d' -e 's,^,../,' filelist` l="$l `echo ../src/include/*.i ../src/utilities/*.c ../test/*/*.c`" +# List of include files for source #defines. +# Ignore the queue.h file, we don't use most of it. +dl="../src/include/*.[hi] ../src/include/*.in" +dl=`echo $dl | sed 's/ [^ ]*queue.h//'` + ( # Copy out the list of #defines we don't use, but it's OK. sed -e '/^$/d' -e '/^#/d' < s_define.list -# Get the list of #defines. -# Ignore the list of configuration objects -# Ignore the list of statistic "keys" generated for applications. -search=`cat ../src/include/*.[hi] ../src/include/*.in | +# Search the list of include files for #defines +# Ignore configuration objects #defines +# Ignore statistic "keys" generated for applications #defines +search=`cat $dl | sed -e '/configuration section: BEGIN/,/configuration section: END/d' \ -e '/Statistics section: BEGIN/,/Statistics section: END/d' | egrep '^#define' | diff --git a/dist/s_define.list b/dist/s_define.list index 4924a1935ae..1bceb6a54fb 100644 --- a/dist/s_define.list +++ b/dist/s_define.list @@ -73,63 +73,3 @@ __WT_ATOMIC_CAS_VAL __WT_ATOMIC_FETCH_ADD __WT_ATOMIC_STORE __WT_ATOMIC_SUB - -# List of queue.h #defines that are "unused", but it's OK. -LIST_EMPTY -LIST_ENTRY -LIST_FIRST -LIST_FOREACH -LIST_HEAD -LIST_HEAD_INITIALIZER -LIST_INIT -LIST_INSERT_AFTER -LIST_INSERT_BEFORE -LIST_INSERT_HEAD -LIST_NEXT -LIST_REMOVE -QMD_TRACE_ELEM -QMD_TRACE_HEAD -QUEUE_MACRO_DEBUG -SLIST_EMPTY -SLIST_ENTRY -SLIST_FIRST -SLIST_FOREACH -SLIST_FOREACH_PREVPTR -SLIST_HEAD -SLIST_HEAD_INITIALIZER -SLIST_INIT -SLIST_INSERT_AFTER -SLIST_INSERT_HEAD -SLIST_NEXT -SLIST_REMOVE -SLIST_REMOVE_HEAD -STAILQ_CONCAT -STAILQ_EMPTY -STAILQ_ENTRY -STAILQ_FIRST -STAILQ_FOREACH -STAILQ_HEAD -STAILQ_HEAD_INITIALIZER -STAILQ_INIT -STAILQ_INSERT_AFTER -STAILQ_INSERT_HEAD -STAILQ_INSERT_TAIL -STAILQ_LAST -STAILQ_NEXT -STAILQ_REMOVE -STAILQ_REMOVE_HEAD -STAILQ_REMOVE_HEAD_UNTIL -TAILQ_CONCAT -TAILQ_EMPTY -TAILQ_ENTRY -TAILQ_FOREACH_REVERSE -TAILQ_HEAD -TAILQ_HEAD_INITIALIZER -TAILQ_INSERT_AFTER -TAILQ_INSERT_BEFORE -TAILQ_LAST -TAILQ_NEXT -TAILQ_PREV -TRACEBUF -TRASHIT -_DB_QUEUE_H_ diff --git a/src/lsm/lsm_manager.c b/src/lsm/lsm_manager.c index 84c509158d1..1ea41f24ee2 100644 --- a/src/lsm/lsm_manager.c +++ b/src/lsm/lsm_manager.c @@ -274,7 +274,7 @@ __wt_lsm_manager_destroy(WT_SESSION_IMPL *session) WT_CONNECTION_IMPL *conn; WT_DECL_RET; WT_LSM_MANAGER *manager; - WT_LSM_WORK_UNIT *current, *next; + WT_LSM_WORK_UNIT *current; WT_SESSION *wt_session; uint32_t i; uint64_t removed; @@ -298,23 +298,17 @@ __wt_lsm_manager_destroy(WT_SESSION_IMPL *session) manager->lsm_worker_cookies[0].tid = 0; /* Release memory from any operations left on the queue. */ - for (current = TAILQ_FIRST(&manager->switchqh); - current != NULL; current = next) { - next = TAILQ_NEXT(current, q); + while ((current = TAILQ_FIRST(&manager->switchqh)) != NULL) { TAILQ_REMOVE(&manager->switchqh, current, q); ++removed; __wt_lsm_manager_free_work_unit(session, current); } - for (current = TAILQ_FIRST(&manager->appqh); - current != NULL; current = next) { - next = TAILQ_NEXT(current, q); + while ((current = TAILQ_FIRST(&manager->appqh)) != NULL) { TAILQ_REMOVE(&manager->appqh, current, q); ++removed; __wt_lsm_manager_free_work_unit(session, current); } - for (current = TAILQ_FIRST(&manager->managerqh); - current != NULL; current = next) { - next = TAILQ_NEXT(current, q); + while ((current = TAILQ_FIRST(&manager->managerqh)) != NULL) { TAILQ_REMOVE(&manager->managerqh, current, q); ++removed; __wt_lsm_manager_free_work_unit(session, current); diff --git a/src/txn/txn_nsnap.c b/src/txn/txn_nsnap.c index d0316ecef95..be736cc1c98 100644 --- a/src/txn/txn_nsnap.c +++ b/src/txn/txn_nsnap.c @@ -358,9 +358,7 @@ __wt_txn_named_snapshot_destroy(WT_SESSION_IMPL *session) txn_global = &S2C(session)->txn_global; txn_global->nsnap_oldest_id = WT_TXN_NONE; - while (!TAILQ_EMPTY(&txn_global->nsnaph)) { - nsnap = TAILQ_FIRST(&txn_global->nsnaph); - WT_ASSERT(session, nsnap != NULL); + while ((nsnap = TAILQ_FIRST(&txn_global->nsnaph)) != NULL) { TAILQ_REMOVE(&txn_global->nsnaph, nsnap, q); __nsnap_destroy(session, nsnap); } |