Nmap Development mailing list archives

Re: [PATCH] Don't compile non-OPENSSL code when using OPENSSL andvice versa


From: Andreas Ericsson <ae () op5 se>
Date: Tue, 28 Feb 2006 22:37:13 +0100

I'm not sure why your replies don't get threaded, but it's fairly 
annoying. Do you have some weird settings in your MUA?

Now, to business.

Kris Katterjohn wrote:
From: Andreas Ericsson
Sent: 2/28/2006 12:10:40 PM

Kris Katterjohn wrote:

While that's most likely very true, is there a reason to make the compiler do it
(just because it should) instead of the preprocessor (because you tell it)?

I'm not by any means saying you're wrong, but I do (at least) think using the
preprocessor #if/#else makes the code more readable/easier to understand rather
than just leaving it out there for the compiler to do.


Perhaps, but considering that of the four patched blocks two were 
"return within ifdef" and two others just moved the #ifdef to above a 
comment, the patch is a no-op for the compiled code with the exception 
of moving that 'int tmp' outside it.


Yeah, I moved the #if around the comments in nbase_rnd.c because when I put the
#else around the bottom part (which, along with tmp, was the point of that part
of the patch) the comment for the non-OpenSSL stuff was inside the #else. So if
I moved the other comments inside, it'd be the same everywhere instead of some
outside and some inside the #if's. I hope that made sense :)


Almost, although I had to read that sentence twice. :)


I'm not sure what you mean by two "return within ifdefs".


A return within ifdef is one that makes the compiler remove all code 
following the #endif, i.e. unconditional return inside an #ifdef block.


The one in
service_scan.cc is, but there are two sections of code with more than just a return toward the end of 
get_random_bytes() in nbase_rnd.c: one for OpenSSL and
not. The #ifdef separates them and also allows for tmp to be separated using #if,
too. Or maybe I just didn't understand what you were saying.


Perhaps not. I was most likely unclear. I didn't mean it as criticism, 
though. I just made an observation.

-- 
Andreas Ericsson                   andreas.ericsson () op5 se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev


Current thread: