Nmap Development mailing list archives

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


From: "Kris Katterjohn" <kjak () ispwest com>
Date: Tue, 28 Feb 2006 12:46:13 -0800

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 :)

I'm not sure what you mean by two "return within ifdefs". 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.


I was just commenting since you didn't seem to be aware of it (no 
comments in the patch message about readability).


Yeah, that was just a "side-effect". The patch wasn't for the readability so I
guess I just didn't say it in there.

Kris Katterjohn



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


Current thread: