mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-10-03 20:55:18 +00:00
Fixed compiling httpd without user-specified memp-pool
This commit is contained in:
parent
f744877247
commit
4dac3ab5f6
@ -40,7 +40,16 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef HTTPD_DEBUG
|
#ifndef HTTPD_DEBUG
|
||||||
#define HTTPD_DEBUG LWIP_DBG_OFF
|
#define HTTPD_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 and add the next line to lwippools.h to use a memp pool
|
||||||
|
* for allocating struct http_state instead of the heap:
|
||||||
|
*
|
||||||
|
* LWIP_MEMPOOL(HTTPD_STATE, 20, 100, "HTTPD_STATE")
|
||||||
|
*/
|
||||||
|
#ifndef HTTPD_USE_MEM_POOL
|
||||||
|
#define HTTPD_USE_MEM_POOL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** The server port for HTTPD to use */
|
/** The server port for HTTPD to use */
|
||||||
@ -90,7 +99,11 @@ static err_t http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err
|
|||||||
static struct http_state*
|
static struct http_state*
|
||||||
http_state_alloc()
|
http_state_alloc()
|
||||||
{
|
{
|
||||||
return (struct http_state*)memp_malloc(MEMP_HTTPD_STATE);
|
#if HTTPD_USE_MEM_POOL
|
||||||
|
return memp_malloc(MEMP_HTTPD_STATE);
|
||||||
|
#else /* HTTPD_USE_MEM_POOL */
|
||||||
|
return mem_malloc(sizeof(struct http_state));
|
||||||
|
#endif /* HTTPD_USE_MEM_POOL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Free a struct http_state.
|
/** Free a struct http_state.
|
||||||
@ -105,7 +118,11 @@ http_state_free(struct http_state *hs)
|
|||||||
mem_free((void*)hs->file_orig);
|
mem_free((void*)hs->file_orig);
|
||||||
}
|
}
|
||||||
#endif /* HTTPD_SUPPORT_DYNAMIC_PAGES */
|
#endif /* HTTPD_SUPPORT_DYNAMIC_PAGES */
|
||||||
|
#if HTTPD_USE_MEM_POOL
|
||||||
memp_free(MEMP_HTTPD_STATE, hs);
|
memp_free(MEMP_HTTPD_STATE, hs);
|
||||||
|
#else /* HTTPD_USE_MEM_POOL */
|
||||||
|
mem_free(hs);
|
||||||
|
#endif /* HTTPD_USE_MEM_POOL */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user