diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-05-01 10:59:02 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-05-01 10:59:02 +0000 |
commit | 4730c88fa3913b813cd68ae57bc6baff225b3448 (patch) | |
tree | 940fa729a1a7b2d87605d20610e266cf6ce9946d /mbuf.c | |
parent | c12753ea7e8ffa0818f620bb5af582fa67c03a70 (diff) | |
download | slirp-4730c88fa3913b813cd68ae57bc6baff225b3448.zip slirp-4730c88fa3913b813cd68ae57bc6baff225b3448.tar.gz slirp-4730c88fa3913b813cd68ae57bc6baff225b3448.tar.bz2 |
fixed realloc logic (Ed Swierk)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1879 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'mbuf.c')
-rw-r--r-- | mbuf.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -137,19 +137,20 @@ void m_cat(m, n) register struct mbuf *m, *n; void m_inc(m, size) struct mbuf *m; int size; { + int datasize; + /* some compiles 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; */ + datasize = m->m_data - m->m_ext; m->m_ext = (char *)realloc(m->m_ext, size); /* if (m->m_ext == NULL) * return (struct mbuf *)NULL; */ - /* m->m_data = m->m_ext + datasize; */ + m->m_data = m->m_ext + datasize; } else { - int datasize; char *dat; datasize = m->m_data - m->m_dat; dat = (char *)malloc(size); |