diff mbox

[2/2] slirp: reformat m_cat routine

Message ID 20180605180836.21485-3-ppandit@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Prasad Pandit June 5, 2018, 6:08 p.m. UTC
From: Prasad J Pandit <pjp@fedoraproject.org>

Coding style changes to the m_cat routine and minor refactoring.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 slirp/mbuf.c | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

Comments

Samuel Thibault June 6, 2018, 9:18 a.m. UTC | #1
P J P, le mar. 05 juin 2018 23:38:36 +0530, a ecrit:
> From: Prasad J Pandit <pjp@fedoraproject.org>
> 
> Coding style changes to the m_cat routine and minor refactoring.

Fixed a bit and applied to my tree, thanks!

Samuel
diff mbox

Patch

diff --git a/slirp/mbuf.c b/slirp/mbuf.c
index 0f45abd917..30e3b2719d 100644
--- a/slirp/mbuf.c
+++ b/slirp/mbuf.c
@@ -151,32 +151,28 @@  m_cat(struct mbuf *m, struct mbuf *n)
 void
 m_inc(struct mbuf *m, int size)
 {
-	int datasize;
+    int datasize;
 
-	/* some compiles throw up on gotos.  This one we can fake. */
-        if(m->m_size>size) return;
+    /* 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;
-          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_flags |= M_EXT;
-        }
-
-        m->m_size = size + datasize;
+    if (m->m_flags & M_EXT) {
+        datasize = m->m_data - m->m_ext;
+        m->m_ext = g_realloc(m->m_ext, size + datasize);
+    } else {
+        datasize = m->m_data - m->m_dat;
+        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;
 }
 
 
-
 void
 m_adj(struct mbuf *m, int len)
 {