From: Stefan de Konink Date: Thu, 13 May 2010 20:08:15 +0000 (+0200) Subject: Some pretty code fixes and memoryleak addressing. X-Git-Url: https://repo.or.cz/w/mistral.git/commitdiff_plain/fdf170e8be04f68706cb80295d3002040a454358 Some pretty code fixes and memoryleak addressing. --- diff --git a/mistral.c b/mistral.c index 8e68b2f..6645dbb 100644 --- a/mistral.c +++ b/mistral.c @@ -105,7 +105,7 @@ static void write_cb(struct ev_loop *loop, struct ev_io *w, int revents) { struct client *cli = (struct client *) w->data; - if(EV_ERROR & revents) { + if (EV_ERROR & revents) { ev_timer_start(loop, &cli->ev_goodbye); return; } @@ -144,7 +144,6 @@ static inline void* execute_php(void *_cli) { cli->rlen = 0; FREE_ZVAL(http_headers[0]); /* Free's the object itself */ - if (result == SUCCESS) { if (Z_TYPE_P(&retval) == IS_STRING) { cli->rlen = 256 + Z_STRLEN_P(&retval); @@ -240,6 +239,7 @@ static inline void* execute_php(void *_cli) { test += 2; } } + zval_dtor(&temp); } } @@ -396,7 +396,7 @@ PHP_FUNCTION(mistral_init) hints.ai_flags = AI_ADDRCONFIG || AI_NUMERICSERV; hints.ai_socktype = SOCK_STREAM; - if (getaddrinfo (listen_addr, "", &hints, &ai) != 0) { + if (getaddrinfo(listen_addr, "", &hints, &ai) != 0) { RETURN_NULL(); } @@ -445,7 +445,7 @@ PHP_FUNCTION(mistral_init) } if (ai) - freeaddrinfo (ai); + freeaddrinfo(ai); if (bind(listen_sock, (struct sockaddr *) &sin, sizeof(sin)) < 0) err(1, "bind failed"); @@ -491,13 +491,14 @@ PHP_FUNCTION(mistral_register_callback) if (old_callback) { _php_event_callback_free(old_callback); } + RETURN_TRUE; } /* }}} */ PHP_FUNCTION(mistral_start) { - struct ev_loop *loop = ev_default_loop (0); + struct ev_loop *loop = ev_default_loop(0); ev_io_start(loop, &ev_accept); ev_loop(loop, 0);