Permalink
Browse files

Merge pull request #63 from patricklucas/fix_warnings

Fixed some compiler warnings.

Thanks to Patrick Lucas for the patch!
  • Loading branch information...
2 parents 4d41383 + b7f508f commit 449e381901ad4c2c1df7594aeea2d586a91f81d8 @jonashaag committed Feb 28, 2012
Showing with 19 additions and 15 deletions.
  1. +2 −2 Makefile
  2. +1 −1 bjoern/bjoernmodule.c
  3. +1 −1 bjoern/common.h
  4. +1 −1 bjoern/filewrapper.c
  5. +1 −1 bjoern/filewrapper.h
  6. +9 −5 bjoern/request.c
  7. +1 −1 bjoern/server.c
  8. +3 −3 setup.py
View
4 Makefile
@@ -13,8 +13,8 @@ objects = $(HTTP_PARSER_OBJ) \
$(wildcard $(SOURCE_DIR)/*.c))
CPPFLAGS += $(PYTHON_INCLUDE) -I . -I $(SOURCE_DIR) -I $(HTTP_PARSER_DIR)
-CFLAGS += $(FEATURES) -std=c99 -fno-strict-aliasing -Wall -Wextra \
- -Wno-unused -g -O0 -fPIC
+CFLAGS += $(FEATURES) -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall \
+ -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g -O0
LDFLAGS += $(PYTHON_LDFLAGS) -l ev -shared -fcommon
ifneq ($(WANT_SENDFILE), no)
View
2 bjoern/bjoernmodule.c
@@ -90,7 +90,7 @@ static PyMethodDef Bjoern_FunctionTable[] = {
{NULL, NULL, 0, NULL}
};
-PyMODINIT_FUNC initbjoern()
+PyMODINIT_FUNC initbjoern(void)
{
_init_common();
_init_filewrapper();
View
2 bjoern/common.h
@@ -21,7 +21,7 @@ typedef struct { char* data; size_t len; } string;
enum http_status { HTTP_BAD_REQUEST = 1, HTTP_LENGTH_REQUIRED, HTTP_SERVER_ERROR };
size_t unquote_url_inplace(char* url, size_t len);
-void (_init_common)();
+void _init_common(void);
PyObject *_REMOTE_ADDR, *_PATH_INFO, *_QUERY_STRING, *_REQUEST_METHOD, *_GET,
*_HTTP_CONTENT_LENGTH, *_CONTENT_LENGTH, *_HTTP_CONTENT_TYPE, *_CONTENT_TYPE,
View
2 bjoern/filewrapper.c
@@ -45,7 +45,7 @@ PyTypeObject FileWrapper_Type = {
(destructor)FileWrapper_dealloc, /* tp_dealloc */
};
-void _init_filewrapper()
+void _init_filewrapper(void)
{
FileWrapper_Type.tp_new = FileWrapper_New;
FileWrapper_Type.tp_iter = FileWrapper_Iter;
View
2 bjoern/filewrapper.h
@@ -9,4 +9,4 @@ typedef struct {
PyObject* file;
} FileWrapper;
-void (_init_filewrapper)();
+void _init_filewrapper(void);
View
14 bjoern/request.c
@@ -108,29 +108,33 @@ void Request_parse(Request* request, const char* data, const size_t data_len)
Py_DECREF(val); \
} while(0)
-static int on_message_begin(http_parser* parser)
+static int
+on_message_begin(http_parser* parser)
{
REQUEST->headers = PyDict_New();
PARSER->field = (string){NULL, 0};
PARSER->value = (string){NULL, 0};
return 0;
}
-static int on_path(http_parser* parser, char* path, size_t len)
+static int
+on_path(http_parser* parser, const char* path, size_t len)
{
- if(!(len = unquote_url_inplace(path, len)))
+ if(!(len = unquote_url_inplace((char*)path, len)))
return 1;
_set_header_free_value(_PATH_INFO, PyString_FromStringAndSize(path, len));
return 0;
}
-static int on_query_string(http_parser* parser, const char* query, size_t len)
+static int
+on_query_string(http_parser* parser, const char* query, size_t len)
{
_set_header_free_value(_QUERY_STRING, PyString_FromStringAndSize(query, len));
return 0;
}
-static int on_header_field(http_parser* parser, const char* field, size_t len)
+static int
+on_header_field(http_parser* parser, const char* field, size_t len)
{
if(PARSER->value.data) {
/* Store previous header and start a new one */
View
2 bjoern/server.c
@@ -60,7 +60,7 @@ void server_run(void)
Py_END_ALLOW_THREADS
}
-static void cleanup() {
+static void cleanup(void) {
close(sockinfo.fd);
if(sockinfo.filename)
unlink(sockinfo.filename);
View
6 setup.py
@@ -12,9 +12,9 @@
include_dirs = ['http-parser'],
define_macros = [('WANT_SENDFILE', '1'),
('WANT_SIGINT_HANDLING', '1')],
- extra_compile_args = ['-std=c99', '-fno-strict-aliasing', '-Wall',
- '-Wextra', '-Wno-unused', '-g', '-fPIC',
- '-Wno-missing-field-initializers', '-fcommon']
+ extra_compile_args = ['-std=c99', '-fno-strict-aliasing', '-fcommon',
+ '-fPIC', '-Wall', '-Wextra', '-Wno-unused-parameter',
+ '-Wno-missing-field-initializers', '-g']
)
setup(

0 comments on commit 449e381

Please sign in to comment.