aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrasad J Pandit <pjp@fedoraproject.org>2018-06-05 23:38:35 +0530
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-06-08 09:08:30 +0300
commit193b8054e11239736ba4c9d01ee9ed0b88da08bd (patch)
tree6a979fbf56323673e5c939bc0b7d5b65c7a28638
parent48b6c898f33297a9bb731ff719c678b2aebff474 (diff)
downloadslirp-3.0.0-rc1.zip
slirp-3.0.0-rc1.tar.gz
slirp-3.0.0-rc1.tar.bz2
slirp: reformat m_inc routinev3.0.0-rc3v3.0.0-rc2v3.0.0-rc1v3.0.0-rc0
Coding style changes to the m_inc routine and minor refactoring. Reported-by: ZDI Disclosures <zdi-disclosures@trendmicro.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r--mbuf.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/mbuf.c b/mbuf.c
index 46c4db1..2b1ef63 100644
--- a/mbuf.c
+++ b/mbuf.c
@@ -147,25 +147,22 @@ void m_inc(struct mbuf *m, int size)
{
int datasize;
- /* some compiles throw up on gotos. This one we can fake. */
- if (m->m_size > size)
+ /* some compilers throw up on gotos. This one we can fake. */
+ if (m->m_size > size) {
return;
+ }
if (m->m_flags & M_EXT) {
datasize = m->m_data - m->m_ext;
m->m_ext = g_realloc(m->m_ext, size + datasize);
- m->m_data = m->m_ext + datasize;
} else {
- char *dat;
datasize = m->m_data - m->m_dat;
- dat = g_malloc(size + datasize);
- memcpy(dat, m->m_dat, m->m_size);
-
- m->m_ext = dat;
- m->m_data = m->m_ext + datasize;
+ m->m_ext = g_malloc(size + datasize);
+ memcpy(m->m_ext, m->m_dat, m->m_size);
m->m_flags |= M_EXT;
}
+ m->m_data = m->m_ext + datasize;
m->m_size = size + datasize;
}