+ memb_inmemb

This commit is contained in:
adamdunkels 2007-03-16 16:53:33 +00:00
parent 997a286b5d
commit 943a12613f
2 changed files with 13 additions and 11 deletions

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: memb.c,v 1.2 2006/08/16 22:12:46 oliverschmidt Exp $
* $Id: memb.c,v 1.3 2007/03/16 16:53:33 adamdunkels Exp $
*/
/**
@ -101,5 +101,12 @@ memb_free(struct memb_blocks *m, void *ptr)
return -1;
}
/*---------------------------------------------------------------------------*/
int
memb_inmemb(struct memb_blocks *m, void *ptr)
{
return (char *)ptr >= (char *)m->mem &&
(char *)ptr < (char *)m->mem + (m->num * m->size);
}
/*---------------------------------------------------------------------------*/
/** @} */