/[lwip]/lwip/src/core/memp.c
ViewVC logotype

Diff of /lwip/src/core/memp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by likewise, Sat Oct 19 13:00:22 2002 UTC revision 1.2 by likewise, Mon Nov 11 14:31:00 2002 UTC
# Line 118  memp_sanity(void) Line 118  memp_sanity(void)
118  {  {
119    int i, c;    int i, c;
120    struct memp *m, *n;    struct memp *m, *n;
121      
122    for(i = 0; i < MEMP_MAX; i++) {    for(i = 0; i < MEMP_MAX; i++) {
123      for(m = memp_tab[i]; m != NULL; m = m->next) {      for(m = memp_tab[i]; m != NULL; m = m->next) {
124        c = 1;        c = 1;
125        for(n = memp_tab[i]; n != NULL; n = n->next) {        for(n = memp_tab[i]; n != NULL; n = n->next) {
126          if(n == m) {          if(n == m) {
127            --c;                  --c;
128          }          }
129          if(c < 0)                if(c < 0) return 0; /* LW was: abort(); */
           abort();  
130        }        }
131      }      }
132    }    }
# Line 178  void * Line 177  void *
177  memp_malloc(memp_t type)  memp_malloc(memp_t type)
178  {  {
179    struct memp *memp;    struct memp *memp;
180      void *mem;
181    
182    ASSERT("memp_malloc: type < MEMP_MAX", type < MEMP_MAX);    ASSERT("memp_malloc: type < MEMP_MAX", type < MEMP_MAX);
183    
184    memp = memp_tab[type];    memp = memp_tab[type];
# Line 195  memp_malloc(memp_t type) Line 195  memp_malloc(memp_t type)
195      ASSERT("memp_malloc: memp properly aligned",      ASSERT("memp_malloc: memp properly aligned",
196             ((u32_t)MEM_ALIGN((u8_t *)memp + sizeof(struct memp)) % MEM_ALIGNMENT) == 0);             ((u32_t)MEM_ALIGN((u8_t *)memp + sizeof(struct memp)) % MEM_ALIGNMENT) == 0);
197    
198      return MEM_ALIGN((u8_t *)memp + sizeof(struct memp));      mem = MEM_ALIGN((u8_t *)memp + sizeof(struct memp));
199        /* initialize memp memory with zeroes */
200        bzero(mem, memp_sizes[type]);      
201        return mem;
202    } else {    } else {
203      DEBUGF(MEMP_DEBUG, ("memp_malloc: out of memory in pool %d\n", type));      DEBUGF(MEMP_DEBUG, ("memp_malloc: out of memory in pool %d\n", type));
204  #ifdef MEMP_STATS  #ifdef MEMP_STATS

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26