Abstract out some functionality into some more Macro's and eliminate
duplicate code. Reviwed by: Archie Cobbs <archie@freebsd.org>
This commit is contained in:
parent
923a651ddf
commit
9e7c07ec3b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52501
@ -257,13 +257,34 @@ union mcluster {
|
||||
} \
|
||||
}
|
||||
|
||||
#define MCLFREE1(p) \
|
||||
do { \
|
||||
if (--mclrefcnt[mtocl(p)] == 0) { \
|
||||
((union mcluster *)(p))->mcl_next = mclfree; \
|
||||
mclfree = (union mcluster *)(p); \
|
||||
mbstat.m_clfree++; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MCLFREE(p) \
|
||||
MBUFLOCK ( \
|
||||
if (--mclrefcnt[mtocl(p)] == 0) { \
|
||||
((union mcluster *)(p))->mcl_next = mclfree; \
|
||||
mclfree = (union mcluster *)(p); \
|
||||
mbstat.m_clfree++; \
|
||||
} \
|
||||
MBUFLOCK( \
|
||||
MCLFREE1(p); \
|
||||
)
|
||||
|
||||
#define MEXTFREE1(m) \
|
||||
do { \
|
||||
if ((m)->m_ext.ext_free) \
|
||||
(*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \
|
||||
(m)->m_ext.ext_size); \
|
||||
else { \
|
||||
char *p = (m)->m_ext.ext_buf; \
|
||||
MCLFREE1(p); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MEXTFREE(m) \
|
||||
MBUFLOCK( \
|
||||
MCLEXTFREE1(m); \
|
||||
)
|
||||
|
||||
/*
|
||||
@ -275,17 +296,7 @@ union mcluster {
|
||||
MBUFLOCK( \
|
||||
mbstat.m_mtypes[(m)->m_type]--; \
|
||||
if ((m)->m_flags & M_EXT) { \
|
||||
if ((m)->m_ext.ext_free) \
|
||||
(*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \
|
||||
(m)->m_ext.ext_size); \
|
||||
else { \
|
||||
char *p = (m)->m_ext.ext_buf; \
|
||||
if (--mclrefcnt[mtocl(p)] == 0) { \
|
||||
((union mcluster *)(p))->mcl_next = mclfree; \
|
||||
mclfree = (union mcluster *)(p); \
|
||||
mbstat.m_clfree++; \
|
||||
} \
|
||||
} \
|
||||
MEXTFREE1(m); \
|
||||
} \
|
||||
(n) = (m)->m_next; \
|
||||
(m)->m_type = MT_FREE; \
|
||||
|
Loading…
Reference in New Issue
Block a user