summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-09-14 00:58:55 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-09-14 03:49:20 -0500
commite50ab7bb891cbd7b5f95c124ce29a3e595b599ee (patch)
treee5c248e9b6a0084ecb4b90eff10b6659aea74f23 /sal
parenta13c3a68df9327d3a1d0283006a3cf755291484a (diff)
remove SAL_MAX() macros and few users
Change-Id: I5ece116a66ab37fe64aac6c60bc38244677d499a
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/sal/macros.h3
-rw-r--r--sal/rtl/source/alloc_arena.cxx11
-rw-r--r--sal/rtl/source/alloc_cache.cxx20
3 files changed, 25 insertions, 9 deletions
diff --git a/sal/inc/sal/macros.h b/sal/inc/sal/macros.h
index 5ccdee3c4e5d..fb52d3c686a6 100644
--- a/sal/inc/sal/macros.h
+++ b/sal/inc/sal/macros.h
@@ -31,9 +31,6 @@
#include <stddef.h>
-#ifndef SAL_MAX
-# define SAL_MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
#ifndef SAL_MIN
# define SAL_MIN(a,b) (((a) < (b)) ? (a) : (b))
diff --git a/sal/rtl/source/alloc_arena.cxx b/sal/rtl/source/alloc_arena.cxx
index 1223e0e3f0c1..fe066df22620 100644
--- a/sal/rtl/source/alloc_arena.cxx
+++ b/sal/rtl/source/alloc_arena.cxx
@@ -1011,7 +1011,7 @@ SAL_CALL rtl_arena_alloc (
/* resize */
assert(segment->m_size >= size);
oversize = segment->m_size - size;
- if (oversize >= SAL_MAX(arena->m_quantum, arena->m_qcache_max))
+ if ((oversize >= arena->m_quantum) && (oversize >= arena->m_qcache_max))
{
rtl_arena_segment_type * remainder = 0;
rtl_arena_segment_get (arena, &remainder);
@@ -1174,7 +1174,14 @@ SAL_CALL rtl_machdep_alloc (
size -= (pArena->m_quantum + pArena->m_quantum); /* "red-zone" pages */
#else
/* default allocation granularity */
- size = RTL_MEMORY_P2ROUNDUP(size, SAL_MAX(pArena->m_quantum, 64 << 10));
+ if(pArena->m_quantum < (64 << 10))
+ {
+ size = RTL_MEMORY_P2ROUNDUP(size, (64 << 10));
+ }
+ else
+ {
+ size = RTL_MEMORY_P2ROUNDUP(size, pArena->m_quantum);
+ }
#endif
#if defined(SAL_UNX)
diff --git a/sal/rtl/source/alloc_cache.cxx b/sal/rtl/source/alloc_cache.cxx
index e5352bbbcb87..8e6860253448 100644
--- a/sal/rtl/source/alloc_cache.cxx
+++ b/sal/rtl/source/alloc_cache.cxx
@@ -838,7 +838,10 @@ rtl_cache_activate (
snprintf (cache->m_name, sizeof(cache->m_name), "%s", name);
/* ensure minimum size (embedded bufctl linkage) */
- objsize = SAL_MAX(objsize, sizeof(rtl_cache_bufctl_type*));
+ if(objsize < sizeof(rtl_cache_bufctl_type*))
+ {
+ objsize = sizeof(rtl_cache_bufctl_type*);
+ }
if (objalign == 0)
{
@@ -851,7 +854,10 @@ rtl_cache_activate (
else
{
/* ensure minimum alignment */
- objalign = SAL_MAX(objalign, RTL_MEMORY_ALIGNMENT_4);
+ if(objalign < RTL_MEMORY_ALIGNMENT_4)
+ {
+ objalign = RTL_MEMORY_ALIGNMENT_4;
+ }
}
assert(RTL_MEMORY_ISP2(objalign));
@@ -871,12 +877,18 @@ rtl_cache_activate (
if (flags & RTL_CACHE_FLAG_QUANTUMCACHE)
{
/* next power of 2 above 3 * qcache_max */
- slabsize = SAL_MAX(slabsize, (1UL << highbit(3 * source->m_qcache_max)));
+ if(slabsize < (1UL << highbit(3 * source->m_qcache_max)))
+ {
+ slabsize = (1UL << highbit(3 * source->m_qcache_max));
+ }
}
else
{
/* waste at most 1/8 of slab */
- slabsize = SAL_MAX(slabsize, cache->m_type_size * 8);
+ if(slabsize < cache->m_type_size * 8)
+ {
+ slabsize = cache->m_type_size * 8;
+ }
}
slabsize = RTL_MEMORY_P2ROUNDUP(slabsize, source->m_quantum);