Module: sip-router
Branch: master
Commit: b0c1c3fb3bd53b65022fd1e2d6d34023db9043c6
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b0c1c3f…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Oct 1 01:06:03 2009 +0200
core: fix gcc 2.9x #ifdef in macro args
gcc version < 3.0 do not support compile directives in macro
arguments.
---
rpc_lookup.c | 8 ++++++--
tcp_main.c | 17 +++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/rpc_lookup.c b/rpc_lookup.c
index 2bc286f..1b03dae 100644
--- a/rpc_lookup.c
+++ b/rpc_lookup.c
@@ -94,13 +94,17 @@ static int rpc_hash_add(struct rpc_export* rpc)
doc0_len=rpc->doc_str[0]?strlen(rpc->doc_str[0]):0;
doc1_len=rpc->doc_str[1]?strlen(rpc->doc_str[1]):0;
/* alloc everything into one block */
- e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry))
+
#ifdef RPC_COPY_EXPORT
+ e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry))
+ROUND_POINTER(sizeof(*rpc))+2*sizeof(char*)+
+name_len+1+doc0_len+(rpc->doc_str[0]!=0)
+doc1_len+(rpc->doc_str[1]!=0)
-#endif /* RPC_COPY_EXPORT */
);
+#else /* RPC_COPY_EXPORT */
+ e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry)));
+#endif /* RPC_COPY_EXPORT */
+
if (e==0){
ERR("out of memory\n");
goto error;
diff --git a/tcp_main.c b/tcp_main.c
index 0164d22..77ecdf5 100644
--- a/tcp_main.c
+++ b/tcp_main.c
@@ -1983,19 +1983,20 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* from,
/* get_fd: */
#ifdef TCP_ASYNC
/* if data is already queued, we don't need the fd any more */
- if (unlikely(cfg_get(tcp, tcp_cfg, async) &&
- (_wbufq_non_empty(c)
#ifdef TCP_CONNECT_WAIT
- || (c->flags&F_CONN_PENDING)
+ if (unlikely(cfg_get(tcp, tcp_cfg, async) &&
+ (_wbufq_non_empty(c) || (c->flags&F_CONN_PENDING)) ))
+#else /* ! TCP_CONNECT_WAIT */
+ if (unlikely(cfg_get(tcp, tcp_cfg, async) && (_wbufq_non_empty(c)) ))
#endif /* TCP_CONNECT_WAIT */
- ) )){
+ {
lock_get(&c->write_lock);
- if (likely(_wbufq_non_empty(c)
#ifdef TCP_CONNECT_WAIT
- || (c->flags&F_CONN_PENDING)
+ if (likely(_wbufq_non_empty(c) || (c->flags&F_CONN_PENDING)))
+#else /* ! TCP_CONNECT_WAIT */
+ if (likely(_wbufq_non_empty(c)))
#endif /* TCP_CONNECT_WAIT */
-
- )){
+ {
do_close_fd=0;
if (unlikely(_wbufq_add(c, buf, len)<0)){
lock_release(&c->write_lock);