Ver código fonte

core: fix gcc 2.9x #ifdef in macro args

gcc version < 3.0 do not support compile directives in macro
arguments.
Andrei Pelinescu-Onciul 16 anos atrás
pai
commit
b0c1c3fb3b
2 arquivos alterados com 15 adições e 10 exclusões
  1. 6 2
      rpc_lookup.c
  2. 9 8
      tcp_main.c

+ 6 - 2
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;

+ 9 - 8
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);