[PPL-devel] [GIT] ppl/ppl(master): Minor code readability improvements.
Roberto Bagnara
bagnara at cs.unipr.it
Fri Mar 27 22:14:42 CET 2009
Module: ppl/ppl
Branch: master
Commit: ddb928b1b124b465929fbbc31ec80b9f13252567
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=ddb928b1b124b465929fbbc31ec80b9f13252567
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Fri Mar 27 21:52:40 2009 +0100
Minor code readability improvements.
---
demos/ppl_lcdd/ppl_lcdd.cc | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/demos/ppl_lcdd/ppl_lcdd.cc b/demos/ppl_lcdd/ppl_lcdd.cc
index 19d7889..a3af359 100644
--- a/demos/ppl_lcdd/ppl_lcdd.cc
+++ b/demos/ppl_lcdd/ppl_lcdd.cc
@@ -126,7 +126,7 @@ typedef Polyhedron* POLYHEDRON_TYPE;
#if defined(PPL_HAVE_SYS_RESOURCE_H) \
&& (defined(SA_ONESHOT) || defined(SA_RESETHAND))
-#define PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
+# define PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
#endif
namespace {
@@ -155,7 +155,7 @@ static const char* usage_string
"Options:\n"
#ifdef PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
" -CSECS, --max-cpu=SECS limits CPU usage to SECS seconds\n"
-#endif
+#endif // defined(PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME)
" -RMB, --max-memory=MB limits memory usage to MB megabytes\n"
" -h, --help prints this help text to stdout\n"
" -oPATH, --output=PATH appends output to PATH\n"
@@ -181,10 +181,8 @@ static const char* usage_string
const char* program_name = 0;
#ifdef PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
-
unsigned long max_seconds_of_cpu_time = 0;
-
-#endif
+#endif // defined(PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME)
unsigned long max_bytes_of_virtual_memory = 0;
bool print_timings = false;
@@ -298,7 +296,7 @@ set_alarm_on_cpu_time(const unsigned seconds, sig_handler_type handler) {
#elif defined(SA_RESETHAND)
s.sa_flags = SA_RESETHAND;
#else
-#error "Either SA_ONESHOT or SA_RESETHAND must be defined."
+# error "Either SA_ONESHOT or SA_RESETHAND must be defined."
#endif
if (sigaction(SIGXCPU, &s, 0) != 0)
@@ -318,6 +316,7 @@ set_alarm_on_cpu_time(const unsigned seconds, sig_handler_type handler) {
#endif // PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
#if PPL_HAVE_DECL_RLIMIT_AS
+
void
limit_virtual_memory(const unsigned bytes) {
struct rlimit t;
@@ -331,10 +330,13 @@ limit_virtual_memory(const unsigned bytes) {
fatal("setrlimit failed: %s", strerror(errno));
}
}
+
#else
+
void
limit_virtual_memory(unsigned) {
}
+
#endif // !PPL_HAVE_DECL_RLIMIT_AS
extern "C" void
@@ -393,7 +395,7 @@ process_options(int argc, char* argv[]) {
max_seconds_of_cpu_time = l;
break;
-#endif
+#endif // defined(PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME)
case 'R':
l = strtol(optarg, &endptr, 10);
@@ -1168,7 +1170,7 @@ main(int argc, char* argv[]) try {
if (max_seconds_of_cpu_time > 0)
set_alarm_on_cpu_time(max_seconds_of_cpu_time, timeout);
-#endif
+#endif // defined(PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME)
if (max_bytes_of_virtual_memory > 0)
limit_virtual_memory(max_bytes_of_virtual_memory);
More information about the PPL-devel
mailing list