Browse code

core: fix gcc 2.9x #ifdef in macro args

gcc version < 3.0 do not support compile directives in macro
arguments.

Andrei Pelinescu-Onciul authored on 30/09/2009 23:06:03
Showing 2 changed files
... ...
@@ -94,13 +94,17 @@ static int rpc_hash_add(struct rpc_export* rpc)
94 94
 	doc0_len=rpc->doc_str[0]?strlen(rpc->doc_str[0]):0;
95 95
 	doc1_len=rpc->doc_str[1]?strlen(rpc->doc_str[1]):0;
96 96
 	/* alloc everything into one block */
97
-	e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry))
97
+	
98 98
 #ifdef RPC_COPY_EXPORT
99
+	e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry))
99 100
 								+ROUND_POINTER(sizeof(*rpc))+2*sizeof(char*)+
100 101
 								+name_len+1+doc0_len+(rpc->doc_str[0]!=0)
101 102
 								+doc1_len+(rpc->doc_str[1]!=0)
102
-#endif /* RPC_COPY_EXPORT */
103 103
 								);
104
+#else /* RPC_COPY_EXPORT */
105
+	e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry)));
106
+#endif /* RPC_COPY_EXPORT */
107
+	
104 108
 	if (e==0){
105 109
 		ERR("out of memory\n");
106 110
 		goto error;
... ...
@@ -1983,19 +1983,20 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* from,
1983 1983
 /* get_fd: */
1984 1984
 #ifdef TCP_ASYNC
1985 1985
 		/* if data is already queued, we don't need the fd any more */
1986
-		if (unlikely(cfg_get(tcp, tcp_cfg, async) &&
1987
-						(_wbufq_non_empty(c)
1988 1986
 #ifdef TCP_CONNECT_WAIT
1989
-											|| (c->flags&F_CONN_PENDING)
1987
+		if (unlikely(cfg_get(tcp, tcp_cfg, async) &&
1988
+						(_wbufq_non_empty(c) || (c->flags&F_CONN_PENDING)) ))
1989
+#else /* ! TCP_CONNECT_WAIT */
1990
+		if (unlikely(cfg_get(tcp, tcp_cfg, async) && (_wbufq_non_empty(c)) ))
1990 1991
 #endif /* TCP_CONNECT_WAIT */
1991
-						) )){
1992
+		{
1992 1993
 			lock_get(&c->write_lock);
1993
-				if (likely(_wbufq_non_empty(c)
1994 1994
 #ifdef TCP_CONNECT_WAIT
1995
-							|| (c->flags&F_CONN_PENDING)
1995
+				if (likely(_wbufq_non_empty(c) || (c->flags&F_CONN_PENDING)))
1996
+#else /* ! TCP_CONNECT_WAIT */
1997
+				if (likely(_wbufq_non_empty(c)))
1996 1998
 #endif /* TCP_CONNECT_WAIT */
1997
-
1998
-							)){
1999
+				{
1999 2000
 					do_close_fd=0;
2000 2001
 					if (unlikely(_wbufq_add(c, buf, len)<0)){
2001 2002
 						lock_release(&c->write_lock);