From d298fcbbd0615390cba881e68ec23dca52d2a1b9 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 6 Apr 2009 21:18:03 +0000 Subject: [PATCH] Changed name of the internal struct memb_blocks to struct memb for consistency --- core/lib/memb.c | 10 +++++----- core/lib/memb.h | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/lib/memb.c b/core/lib/memb.c index a599bd67d..cf60f4beb 100644 --- a/core/lib/memb.c +++ b/core/lib/memb.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: memb.c,v 1.3 2007/03/16 16:53:33 adamdunkels Exp $ + * $Id: memb.c,v 1.4 2009/04/06 21:18:03 adamdunkels Exp $ */ /** @@ -50,14 +50,14 @@ /*---------------------------------------------------------------------------*/ void -memb_init(struct memb_blocks *m) +memb_init(struct memb *m) { memset(m->count, 0, m->num); memset(m->mem, 0, m->size * m->num); } /*---------------------------------------------------------------------------*/ void * -memb_alloc(struct memb_blocks *m) +memb_alloc(struct memb *m) { int i; @@ -77,7 +77,7 @@ memb_alloc(struct memb_blocks *m) } /*---------------------------------------------------------------------------*/ char -memb_free(struct memb_blocks *m, void *ptr) +memb_free(struct memb *m, void *ptr) { int i; char *ptr2; @@ -102,7 +102,7 @@ memb_free(struct memb_blocks *m, void *ptr) } /*---------------------------------------------------------------------------*/ int -memb_inmemb(struct memb_blocks *m, void *ptr) +memb_inmemb(struct memb *m, void *ptr) { return (char *)ptr >= (char *)m->mem && (char *)ptr < (char *)m->mem + (m->num * m->size); diff --git a/core/lib/memb.h b/core/lib/memb.h index 6e6805740..21a5b8b47 100644 --- a/core/lib/memb.h +++ b/core/lib/memb.h @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: memb.h,v 1.5 2008/10/15 14:17:28 nvt-se Exp $ + * $Id: memb.h,v 1.6 2009/04/06 21:18:04 adamdunkels Exp $ */ /** @@ -90,11 +90,11 @@ MEMB(connections, struct connection, 16); #define MEMB(name, structure, num) \ static char CC_CONCAT(name,_memb_count)[num]; \ static structure CC_CONCAT(name,_memb_mem)[num]; \ - static struct memb_blocks name = {sizeof(structure), num, \ + static struct memb name = {sizeof(structure), num, \ CC_CONCAT(name,_memb_count), \ (void *)CC_CONCAT(name,_memb_mem)} -struct memb_blocks { +struct memb { unsigned short size; unsigned short num; char *count; @@ -106,14 +106,14 @@ struct memb_blocks { * * \param m A memory block previously declared with MEMB(). */ -void memb_init(struct memb_blocks *m); +void memb_init(struct memb *m); /** * Allocate a memory block from a block of memory declared with MEMB(). * * \param m A memory block previously declared with MEMB(). */ -void *memb_alloc(struct memb_blocks *m); +void *memb_alloc(struct memb *m); /** * Deallocate a memory block from a memory block previously declared @@ -127,9 +127,9 @@ void *memb_alloc(struct memb_blocks *m); * if successfully deallocated) or -1 if the pointer "ptr" did not * point to a legal memory block. */ -char memb_free(struct memb_blocks *m, void *ptr); +char memb_free(struct memb *m, void *ptr); -int memb_inmemb(struct memb_blocks *m, void *ptr); +int memb_inmemb(struct memb *m, void *ptr); /** @} */