diff --git a/async.c b/async.c index f7df4f07..76075b86 100644 --- a/async.c +++ b/async.c @@ -205,7 +205,7 @@ void *async_loop(void *arg1) { static struct uwsgi_async_request *current_request = NULL, *next_async_request = NULL; void *events = event_queue_alloc(64); - struct uwsgi_socket *uwsgi_sock = uwsgi.sockets; + struct uwsgi_socket *uwsgi_sock; uwsgi.async_runqueue = NULL; uwsgi.async_runqueue_cnt = 0; diff --git a/lib/rbtree.c b/lib/rbtree.c index 10b82b68..c14d933c 100644 --- a/lib/rbtree.c +++ b/lib/rbtree.c @@ -25,6 +25,16 @@ #include "../uwsgi.h" +static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p) +{ + rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p; +} +static inline void rb_set_color(struct rb_node *rb, int color) +{ + rb->rb_parent_color = (rb->rb_parent_color & ~1) | color; +} + + static void __rb_rotate_left(struct rb_node *node, struct rb_root *root) { struct rb_node *right = node->rb_right; @@ -282,3 +292,18 @@ void rb_erase(struct rb_node *node, struct rb_root *root) if (color == RB_BLACK) __rb_erase_color(child, parent, root); } + +#ifdef __clang__ +void rb_link_node(struct rb_node * node, struct rb_node * parent, + struct rb_node ** rb_link) +#else +inline void rb_link_node(struct rb_node * node, struct rb_node * parent, + struct rb_node ** rb_link) +#endif +{ + node->rb_parent_color = (unsigned long )parent; + node->rb_left = node->rb_right = NULL; + + *rb_link = node; +} + diff --git a/lib/rbtree.h b/lib/rbtree.h index 70347e46..42a6d8af 100644 --- a/lib/rbtree.h +++ b/lib/rbtree.h @@ -37,7 +37,6 @@ struct rb_root struct rb_node *rb_node; }; - #define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3)) #define rb_color(r) ((r)->rb_parent_color & 1) #define rb_is_red(r) (!rb_color(r)) @@ -45,24 +44,13 @@ struct rb_root #define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0) #define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0) -static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p) -{ - rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p; -} -static inline void rb_set_color(struct rb_node *rb, int color) -{ - rb->rb_parent_color = (rb->rb_parent_color & ~1) | color; -} - void rb_insert_color(struct rb_node *, struct rb_root *); void rb_erase(struct rb_node *, struct rb_root *); -static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, - struct rb_node ** rb_link) -{ - node->rb_parent_color = (unsigned long )parent; - node->rb_left = node->rb_right = NULL; - - *rb_link = node; -} - +#ifdef __clang__ +void rb_link_node(struct rb_node *, struct rb_node *, + struct rb_node **); +#else +inline void rb_link_node(struct rb_node *, struct rb_node *, + struct rb_node **); +#endif diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 5c2deb2b..e731b0e1 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -115,6 +115,7 @@ char *uwsgi_encode_pydict(PyObject * pydict, uint16_t * size) { if (!key || !val) { PyErr_Print(); + continue; } if (!PyString_Check(key) || !PyString_Check(val)) { @@ -343,7 +344,7 @@ PyObject *py_uwsgi_rpc(PyObject * self, PyObject * args) { argv[i] = PyString_AsString(PyTuple_GetItem(args, i + 2)); } - if (node == (char *) "") { + if (!strcmp(node, "")) { size = uwsgi_rpc(func, 0, NULL, buffer); } else { @@ -2495,6 +2496,7 @@ PyObject *py_uwsgi_cache_exists(PyObject * self, PyObject * args) { } if (remote && strlen(remote) > 0) { + // TODO FIX THIS !!! uwsgi_simple_message_string(remote, 111, 0, key, keylen, buffer, &valsize, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]); if (valsize > 0) { Py_INCREF(Py_True); @@ -2657,6 +2659,7 @@ PyObject *py_uwsgi_cache_get(PyObject * self, PyObject * args) { char *key; uint64_t valsize; + uint16_t valsize16; Py_ssize_t keylen = 0; char *value = NULL; char *remote = NULL; @@ -2672,8 +2675,8 @@ PyObject *py_uwsgi_cache_get(PyObject * self, PyObject * args) { } if (remote && strlen(remote) > 0) { - //uwsgi_simple_message_string(remote, 111, 0, key, keylen, buffer, &valsize, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]); - if (valsize > 0) { + uwsgi_simple_message_string(remote, 111, 0, key, keylen, buffer, &valsize16, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]); + if (valsize16 > 0) { value = buffer; } } diff --git a/protocol.c b/protocol.c index 1d3fb339..1b3634df 100644 --- a/protocol.c +++ b/protocol.c @@ -1121,10 +1121,11 @@ char *uwsgi_simple_message_string(char *socket_name, uint8_t modifier1, uint8_t if (response_len) *response_len = 0; return NULL; } + + if (response_len) *response_len = uh.pktsize; } close(fd); - if (response_len) *response_len = uh.pktsize; return buffer; } diff --git a/uwsgi.c b/uwsgi.c index 977ba761..05d6f428 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -222,7 +222,7 @@ static struct option long_base_options[] = { void uwsgi_configure(void) { - struct option *lopt = uwsgi.long_options; + struct option *lopt; struct option *aopt; char *val; int i; diff --git a/uwsgi.h b/uwsgi.h index a9eda505..8c457dfa 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -33,6 +33,11 @@ #define UWSGI_DECLARE_EMBEDDED_PLUGINS #endif + +#ifdef __clang__ +#define inline +#endif + #define UDEP(pname) extern struct uwsgi_plugin pname##_plugin; #define ULEP(pname)\ @@ -1511,11 +1516,7 @@ struct wsgi_request *find_wsgi_req_by_id(int); void async_add_fd_write(struct wsgi_request *, int, int); void async_add_fd_read(struct wsgi_request *, int, int); -#ifdef __clang__ -struct wsgi_request *next_wsgi_req(struct wsgi_request *); -#else inline struct wsgi_request *next_wsgi_req(struct wsgi_request *); -#endif void async_add_timeout(struct wsgi_request*, int); @@ -1576,13 +1577,8 @@ void uwsgi_ldap_schema_dump_ldif(void); void uwsgi_ldap_config(void); #endif -#ifdef __clang__ -int uwsgi_strncmp(char *, int, char *, int); -int uwsgi_startswith(char *, char *, int); -#else inline int uwsgi_strncmp(char *, int, char *, int); inline int uwsgi_startswith(char *, char *, int); -#endif char *uwsgi_concat(int,...);