[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH] Lies, damn lies and end-of-block comments



I was reading reentr.h and noticed a lot of the endif's for the
HAS_XXX_R macros were wrongly indented and their comments had the
wrong condition.

The attached patch fixes the indentation and removes all but the last
comment which is shortest and furthest from its start.  No point in an
end-of-block comment on a one statement block, just falls out of date
and obscures the structure.

Before:

#ifdef HAS_LOCALTIME_R
#  if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
#   undef localtime
#   if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS
#       define localtime(a) (L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_loc
altime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0)
#  endif /* if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) */
#   if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_I_TS
#       define localtime(a) (L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_loc
altime_struct) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0)
#  endif /* if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) */
#   endif /* HAS_LOCALTIME */
#endif /* HAS_LOCALTIME_R */


After:

#ifdef HAS_LOCALTIME_R
#  if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
#   undef localtime
#   if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS
#       define localtime(a) (L_R_TZSET localtime_r(a,
&PL_reentrant_buffer->_localtime_struct) ?
&PL_reentrant_buffer->_localtime_struct : 0)
#   endif
#   if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_I_TS
#       define localtime(a) (L_R_TZSET localtime_r(a,
&PL_reentrant_buffer->_localtime_struct) == 0 ?
&PL_reentrant_buffer->_localtime_struct : 0)
#   endif
#  endif
#endif /* HAS_LOCALTIME_R */


-- 
The mind is a terrible thing,
and it must be stopped.

diff --git a/reentr.pl b/reentr.pl
index ea327a0..8cc4a5e 100644
--- a/reentr.pl
+++ b/reentr.pl
@@ -751,13 +751,13 @@ EOF
 EOF
 		}
 	    }
-	    push @wrap, <<EOF;
-#  endif /* if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) */
+	    push @wrap, <<EOF;  # !defined(xxx) && XXX_R_PROTO == REENTRANT_PROTO_Y_TS
+#   endif
 EOF
 	}
 
-	    push @wrap, <<EOF;
-#   endif /* HAS_\U$func */
+	    push @wrap, <<EOF;  # defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
+#  endif
 EOF
 
 	push @wrap, $endif, "\n";

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]