aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-03-24 15:25:37 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-03-24 15:25:37 +0000
commitaffb18b2fa81ce88e871e078d71cbc2093c5467c (patch)
treed14f47a24e78327d76fcac4f374107e8f8d6d95c
parent398a94926cdd9adf3c14eff4b757795ca53e2af9 (diff)
downloadgcc-affb18b2fa81ce88e871e078d71cbc2093c5467c.zip
gcc-affb18b2fa81ce88e871e078d71cbc2093c5467c.tar.gz
gcc-affb18b2fa81ce88e871e078d71cbc2093c5467c.tar.bz2
mt_allocator.h (__mt_alloc<>::allocate, [...]): Avoid redundant conditionals.
2004-03-24 Paolo Carlini <pcarlini@suse.de> * include/ext/mt_allocator.h (__mt_alloc<>::allocate, __mt_alloc<>::deallocate): Avoid redundant conditionals. From-SVN: r79917
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h57
2 files changed, 15 insertions, 47 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ef719c8..9a3980f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-24 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/mt_allocator.h (__mt_alloc<>::allocate,
+ __mt_alloc<>::deallocate): Avoid redundant conditionals.
+
2004-03-23 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h: Tweaks for 80 column.
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 7204d84..ce080c7 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -353,16 +353,8 @@ namespace __gnu_cxx
tmp = __bin.first[0]->next;
block = __bin.first[0];
- if (__bin.first[__thread_id] == NULL)
- {
- __bin.first[__thread_id] = block;
- block->next = NULL;
- }
- else
- {
- block->next = __bin.first[__thread_id];
- __bin.first[__thread_id] = block;
- }
+ block->next = __bin.first[__thread_id];
+ __bin.first[__thread_id] = block;
block->thread_id = __thread_id;
__bin.free[__thread_id]++;
@@ -466,16 +458,8 @@ namespace __gnu_cxx
while (remove > 0)
{
tmp = __bin.first[thread_id]->next;
- if (__bin.first[0] == NULL)
- {
- __bin.first[0] = __bin.first[thread_id];
- __bin.first[0]->next = NULL;
- }
- else
- {
- __bin.first[thread_id]->next = __bin.first[0];
- __bin.first[0] = __bin.first[thread_id];
- }
+ __bin.first[thread_id]->next = __bin.first[0];
+ __bin.first[0] = __bin.first[thread_id];
__bin.first[thread_id] = tmp;
__bin.free[thread_id]--;
@@ -486,41 +470,20 @@ namespace __gnu_cxx
// Return this block to our list and update counters and
// owner id as needed.
- if (__bin.first[thread_id] == NULL)
- {
- __bin.first[thread_id] = block;
- block->next = NULL;
- }
- else
- {
- block->next = __bin.first[thread_id];
- __bin.first[thread_id] = block;
- }
+ block->next = __bin.first[thread_id];
+ __bin.first[thread_id] = block;
__bin.free[thread_id]++;
- if (thread_id == block->thread_id)
- __bin.used[thread_id]--;
- else
- {
- __bin.used[block->thread_id]--;
- block->thread_id = thread_id;
- }
+ __bin.used[block->thread_id]--;
+ block->thread_id = thread_id;
}
else
#endif
{
// Single threaded application - return to global pool.
- if (__bin.first[0] == NULL)
- {
- __bin.first[0] = block;
- block->next = NULL;
- }
- else
- {
- block->next = __bin.first[0];
- __bin.first[0] = block;
- }
+ block->next = __bin.first[0];
+ __bin.first[0] = block;
}
}