You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Morgan Pyne <Mo...@eur.sas.com> on 2003/04/16 10:56:18 UTC

jk_channel_apr_socket.c strangeness

Hi all,

I'm compiling mod_jk2 (source code from jakarta-tomcat-connectors-4.1.24-src.tar.gz)
in the following environment:

HP-UX 11, HP's Ansi C compiler, Apache 1.3.27, apr-0.9.1

I get a couple of errors in jk/native2/common/jk_channel_apr_socket.c like:

cc: "../../common/jk_channel_apr_socket.c", line 229: error 1647: Illegal integer-pointer combination for second and third operands of conditional expression (?:).

The line in question (229) is:

  env->l->jkLog(env, env->l, remote_sa->next ? JK_LOG_DEBUG : JK_LOG_ERROR,
                       "channelApr.open(): error %d creating socket %d %s\n",
                       ret, socketInfo->host);


This seems innocent enough, but when I looked up the definitions of the macros
JK_LOG_DEBUG & JK_LOG_ERROR, I see that they are defined in the file
jk/native2/include/jk_logger.h as:

#define JK_LOG_DEBUG __FILE__,__LINE__,JK_LOG_DEBUG_LEVEL
#define JK_LOG_ERROR __FILE__,__LINE__,JK_LOG_ERROR_LEVEL


I thought this looked a bit strange. When you run the C code through the preprocessor,
the resulting code looks like this:


  env->l->jkLog(env, env->l, remote_sa->next ? "../../common/jk_channel_apr_socket.c",229,0  : "../../common/jk_channel_apr_socket.c",229,2 ,
                         "channelApr.open(): error %d creating socket %d %s\n",
                          ret, socketInfo->host);


(apologies for any code wrapping which may take place during posting).


Now, I haven't done any real C in a while, but the above conditional expression doesn't make any sense to me at all, and appears to me malformed. What is this line of code trying to actually achieve ?

Anybody else seen any problems like this?

Would appreciate anybody's insight into this, either with better C knowledge than mine, or a better understanding of what mod_jk2 is trying to do here.

Thanks & regards,
Morgan


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org