dupmbt.c revision 255332
1135446Strhodes/*
2254897Serwin * Copyright (C) 2012 by Darren Reed.
3135446Strhodes *
4135446Strhodes * See the IPFILTER.LICENCE file for details on licencing.
5174187Sdougb *
6135446Strhodes * $Id: dupmbt.c,v 1.3.2.2 2012/07/22 08:04:24 darren_r Exp $
7135446Strhodes */
8135446Strhodes
9135446Strhodes#include "ipf.h"
10135446Strhodes
11135446Strhodesmb_t *dupmbt(orig)
12135446Strhodes	mb_t *orig;
13135446Strhodes{
14135446Strhodes	mb_t *m;
15135446Strhodes
16135446Strhodes	m = (mb_t *)malloc(sizeof(mb_t));
17135446Strhodes	if (m == NULL)
18254897Serwin		return NULL;
19135446Strhodes	m->mb_len = orig->mb_len;
20170222Sdougb	m->mb_next = NULL;
21170222Sdougb	m->mb_data = (char *)m->mb_buf + (orig->mb_data - (char *)orig->mb_buf);
22135446Strhodes	bcopy(orig->mb_data, m->mb_data, m->mb_len);
23135446Strhodes	return m;
24135446Strhodes}
25135446Strhodes