sim: HW_NALLOC: new alloc helper

We have malloc (uninitialized buffer), zalloc (zeroed buffer), and
nzalloc (zeroed array).  But we don't have a way to allocate an
uninitialized array.  Add a HW_NALLOC to fill this gap.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2010-12-29 02:51:40 +00:00
parent e61ddca7fa
commit e71b81d85f
2 changed files with 5 additions and 0 deletions

View file

@ -1,5 +1,9 @@
2010-12-28 Mike Frysinger <vapier@gentoo.org>
* hw-alloc.h (HW_NALLOC): Define.
010-12-28 Mike Frysinger <vapier@gentoo.org>
* hw-alloc.h (HW_NZALLOC): Change ME,TYPE,N to me,type,n.
2010-12-15 Mike Frysinger <vapier@gentoo.org>

View file

@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define HW_ZALLOC(me,type) (type*) hw_zalloc (me, sizeof (type))
#define HW_MALLOC(me,type) (type*) hw_malloc (me, sizeof (type))
#define HW_NALLOC(me,type,n) (type*) hw_malloc (me, sizeof (type) * (n))
#define HW_NZALLOC(me,type,n) (type*) hw_zalloc (me, sizeof (type) * (n))
extern void *hw_zalloc (struct hw *me, unsigned long size);