/[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.14 by likewise, Mon Mar 24 10:29:03 2003 UTC revision 1.15 by likewise, Thu May 1 13:24:01 2003 UTC
# Line 125  memp_sanity(void) Line 125  memp_sanity(void)
125      for(m = memp_tab[i]; m != NULL; m = m->next) {      for(m = memp_tab[i]; m != NULL; m = m->next) {
126        c = 1;        c = 1;
127        for(n = memp_tab[i]; n != NULL; n = n->next) {        for(n = memp_tab[i]; n != NULL; n = n->next) {
128          if(n == m) {          if (n == m) {
129                  --c;                  --c;
130          }          }
131                if(c < 0) return 0; /* LW was: abort(); */                if (c < 0) return 0; /* LW was: abort(); */
132        }        }
133      }      }
134    }    }
# Line 154  memp_init(void) Line 154  memp_init(void)
154    memp = (struct memp *)&memp_memory[0];    memp = (struct memp *)&memp_memory[0];
155    for(i = 0; i < MEMP_MAX; ++i) {    for(i = 0; i < MEMP_MAX; ++i) {
156      size = MEM_ALIGN_SIZE(memp_sizes[i] + sizeof(struct memp));      size = MEM_ALIGN_SIZE(memp_sizes[i] + sizeof(struct memp));
157      if(memp_num[i] > 0) {      if (memp_num[i] > 0) {
158        memp_tab[i] = memp;        memp_tab[i] = memp;
159        m = memp;        m = memp;
160                
# Line 187  memp_malloc(memp_t type) Line 187  memp_malloc(memp_t type)
187    
188    memp = memp_tab[type];    memp = memp_tab[type];
189        
190    if(memp != NULL) {        if (memp != NULL) {    
191      memp_tab[type] = memp->next;          memp_tab[type] = memp->next;    
192      memp->next = NULL;      memp->next = NULL;
193  #ifdef MEMP_STATS  #ifdef MEMP_STATS
194      ++lwip_stats.memp[type].used;      ++lwip_stats.memp[type].used;
195      if(lwip_stats.memp[type].used > lwip_stats.memp[type].max) {      if (lwip_stats.memp[type].used > lwip_stats.memp[type].max) {
196        lwip_stats.memp[type].max = lwip_stats.memp[type].used;        lwip_stats.memp[type].max = lwip_stats.memp[type].used;
197      }      }
198  #endif /* MEMP_STATS */  #endif /* MEMP_STATS */
# Line 238  memp_free(memp_t type, void *mem) Line 238  memp_free(memp_t type, void *mem)
238  {  {
239    struct memp *memp;    struct memp *memp;
240    
241    if(mem == NULL) {    if (mem == NULL) {
242      return;      return;
243    }    }
244    memp = (struct memp *)((u8_t *)mem - sizeof(struct memp));    memp = (struct memp *)((u8_t *)mem - sizeof(struct memp));

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

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