Converted scope-local variables into function-local variables.

The 6502-specific LC implementation doesn't allow for scope-local vaiables between PT_BEGIN/PROCESS_BEGIN/PSOCK_BEGIN and PT_BEGIN/PROCESS_END/PSOCK_END.
This commit is contained in:
Oliver Schmidt 2011-04-12 14:12:09 +02:00
parent b19fb0ac9e
commit 07f3df45be
11 changed files with 50 additions and 44 deletions

View file

@ -392,10 +392,12 @@ content_type_t http_get_header_content_type(http_request_t* request)
static
PT_THREAD(handle_request(connection_state_t* conn_state))
{
static int error;
const char* content_len;
PSOCK_BEGIN(&(conn_state->sin));
static int error;
const char* content_len = NULL;
content_len = NULL;
error = HTTP_NO_ERROR; /*always reinit static variables due to protothreads*/
@ -512,14 +514,19 @@ PT_THREAD(handle_request(connection_state_t* conn_state))
static
PT_THREAD(send_data(connection_state_t* conn_state))
{
uint16_t index;
http_response_t* response;
http_header_t* header;
uint8_t* buffer;
PSOCK_BEGIN(&(conn_state->sout));
PRINTF("send_data -> \n");
uint16_t index = 0;
http_response_t* response = &conn_state->response;
http_header_t* header = response->headers;
uint8_t* buffer = allocate_buffer(200);
index = 0;
response = &conn_state->response;
header = response->headers;
buffer = allocate_buffer(200);
/*FIXME: what is the best solution here to send the data. Right now, if buffer is not allocated, no data is sent!*/
if (buffer) {
@ -583,6 +590,8 @@ PROCESS(http_server, "Httpd Process");
PROCESS_THREAD(http_server, ev, data)
{
connection_state_t *conn_state;
PROCESS_BEGIN();
/* if static routes are used rather than RPL */
@ -603,7 +612,7 @@ PROCESS_THREAD(http_server, ev, data)
while(1) {
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
connection_state_t *conn_state = (connection_state_t *)data;
conn_state = (connection_state_t *)data;
if(uip_connected()) {
PRINTF("##Connected##\n");