Alvaro Lopez Ortega escribió:
On 23 Apr 2008, at 01:59, Perki Pat wrote:
The patch is good, congrats! However, there is a couple of changes that
would improve the patch before we apply it:
- I would move the checking code to the initialize_server_socket()
function in cherokee/server.c file. In that way the port would always be
checked, not only when the -p parameter is used; for instance, it would
ensure that a port read from a configuration file is correct as well.
initialize_server_socket() receives an unsigned short argument for the
port: it's always in range (gcc told me).
It's called from a couple places (server.c:940 and server.c:1070), and
in both places it takes its value from a cherokee_server_t struct, which
has a couple field (port and port_tls) which are also unsigned short.
I'm looking where that fields are assigned. I've found where they're
filled from config file. Now I'll look for more places.
Other choice is to receive an int type, and check it into
initialize_server_socket()
- There are a few macros from printing errors:
PRINT_ERROR_S: Print en error with no parameters.
PRINT_ERROR: Print an error with parameters (needs to be formated).
PRINT_MSG_S: Print a message with no parameters.
PRINT_MSG: Print a message with parameters (needs to be formated).
In this case, I would use PRINT_ERROR_S.
- Ah, and finally, instead of calling exit() it would be better if you
used: return ret_error; That is our equivalent of raising and exception
(well, sort of).
ok, thanks for the advices
I don't remember to have read about coding style at Cherokee's web. I
haven't colaborated in any software projects, every help is welcomed.
There isn't any document defining the coding style, although it would
very interesting to have one. For now the best practice is to look at
the code to see how things are written.
BlueZ uses Linux coding style: http://www.bluez.org/development.html
http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_paper/codingstyle.ps
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m�viles desde 1 c�ntimo por minuto.
http://es.voice.yahoo.com
_______________________________________________
Cherokee mailing list
[email protected]
http://cherokee-project.com/cgi-bin/mailman/listinfo/cherokee