stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r452253 - in /incubator/stdcxx/trunk/util: cmdopt.cpp cmdopt.h display.cpp display.h exec.cpp exec.h output.cpp output.h runall.cpp target.h util.cpp util.h
Date Mon, 02 Oct 2006 23:08:07 GMT
Author: sebor
Date: Mon Oct  2 16:08:06 2006
New Revision: 452253

URL: http://svn.apache.org/viewvc?view=rev&rev=452253
Log:
2006-10-02 Andrew Black <ablack@roguewave.com>

	* cmdopt.cpp: Convert C++ comments to C comments.
	(rw_signal) [!_WIN32 & !_WIN64]: Ditto.
	(parse_limit_opts): Ditto, fix style violation.
	(show_usage): Make static (move from global to file scope).
	(eval_options, split_opt_string): Move documentation from here ...
	* cmdopt.h (eval_options, split_opt_string): ... To here.
	Convert C++ comments to C comments.
	* display.cpp (print_header_plain, print_target_plain,
	print_status_plain, print_footer_plain): Make static, document.
	* display.h: Convert C++ comments to C comments.
	* exec.cpp: Ditto.
	(limit_process) [!_WIN32 & !_WIN64]: Ditto.
	(get_signo): Fix style violation.
	(wait_for_child, exec_file) [!_WIN32 & !_WIN64]: Ditto.
	(wait_for_child) [!_WIN32 & !_WIN64]: Correct embedded comment.
	(get_signo, get_signame, exec_file): Move documentation from here ...
	* exec.h (get_signo, get_signame, exec_file): ... To here.
	Convert C++ comments to C comments.
	* output.cpp (parse_output): Move documentation from here ...
	* output.h (parse_output): ... To here.
	Convert C++ comments to C comments.
	* runall.cpp: Ditto
	* target.h: Ditto, correct file header documentation.
	* util.cpp (guarded_realloc): Fix style violation.
	(terminate, guarded_malloc, guarded_realloc): Move documentation
	from here ...
	* util.h (terminate, guarded_malloc, guarded_realloc): ... To here.
	(terminate): Fix style violation in declaration.
	Convert C++ comments to C comments.

Modified:
    incubator/stdcxx/trunk/util/cmdopt.cpp
    incubator/stdcxx/trunk/util/cmdopt.h
    incubator/stdcxx/trunk/util/display.cpp
    incubator/stdcxx/trunk/util/display.h
    incubator/stdcxx/trunk/util/exec.cpp
    incubator/stdcxx/trunk/util/exec.h
    incubator/stdcxx/trunk/util/output.cpp
    incubator/stdcxx/trunk/util/output.h
    incubator/stdcxx/trunk/util/runall.cpp
    incubator/stdcxx/trunk/util/target.h
    incubator/stdcxx/trunk/util/util.cpp
    incubator/stdcxx/trunk/util/util.h

Modified: incubator/stdcxx/trunk/util/cmdopt.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/cmdopt.cpp?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/cmdopt.cpp (original)
+++ incubator/stdcxx/trunk/util/cmdopt.cpp Mon Oct  2 16:08:06 2006
@@ -24,8 +24,8 @@
  *
  **************************************************************************/
 
-// disable Compaq/HP C++ pure libc headers to allow POSIX symbols
-// such as SIGALRM or SIGKILL to be defined
+/* disable Compaq/HP C++ pure libc headers to allow POSIX symbols
+   such as SIGALRM or SIGKILL to be defined.*/
 #undef __PURE_CNAME
 
 #include <assert.h> /* for assert() */
@@ -144,8 +144,8 @@
     struct sigaction act;
     memset (&act, 0, sizeof act);
 
-    // avoid extern "C"/"C++" mismatch due to an HP aCC 6 bug
-    // (see STDCXX-291)
+    /* avoid extern "C"/"C++" mismatch due to an HP aCC 6 bug
+       (see STDCXX-291) */
     if (func)
         memcpy (&act.sa_handler, &func, sizeof func);
     else
@@ -182,7 +182,7 @@
 
    @param status status code to exit with.
 */
-void 
+static void 
 show_usage (int status)
 {
     FILE* const where = status ? stderr : stdout;
@@ -254,49 +254,49 @@
             &defaults->core,
 #else
             0,
-#endif   // RLIMIT_CORE
+#endif   /* RLIMIT_CORE */
             "core", "CORE", "Core", 4 },
         {
 #ifdef RLIMIT_CPU
             &defaults->cpu,
 #else
             0,
-#endif   // RLIMIT_CPU
+#endif   /* RLIMIT_CPU */
             "cpu", "CPU", "Cpu", 3 },
         {
 #ifdef RLIMIT_DATA
             &defaults->data,
 #else
             0,
-#endif   // RLIMIT_DATA
+#endif   /* RLIMIT_DATA */
             "data", "DATA", "Data", 4 },
         {
 #ifdef RLIMIT_FSIZE
             &defaults->fsize,
 #else
             0,
-#endif   // RLIMIT_FSIZE
+#endif   /* RLIMIT_FSIZE */
             "fsize", "FSIZE", "Fsize", 5 },
         {
 #ifdef RLIMIT_NOFILE
             &defaults->nofile,
 #else
             0,
-#endif   // RLIMIT_NOFILE
+#endif   /* RLIMIT_NOFILE */
             "nofile", "NOFILE", "Nofile", 6 },
         {
 #ifdef RLIMIT_STACK
             &defaults->stack,
 #else
             0,
-#endif   // RLIMIT_STACK
+#endif   /* RLIMIT_STACK */
             "stack", "STACK", "Stack", 5 },
         {
 #ifdef RLIMIT_AS
             &defaults->as,
 #else
             0,
-#endif   // RLIMIT_AS    
+#endif   /* RLIMIT_AS */    
             "as", "AS", "As", 2 },
         { 0, 0, 0, 0, 0 }
     };
@@ -316,8 +316,8 @@
                     || 0 == memcmp (limits [i].mixd, arg, limits [i].len))
                 && ':' == arg [limits [i].len]) {
 
-                // determine whether the hard limit and/or
-                // the soft limit should be set
+                /* determine whether the hard limit and/or the soft limit
+                   should be set. */
                 const bool hard = isupper (arg [0]);
                 const bool soft = islower (arg [1]);
 
@@ -347,7 +347,8 @@
 
                     if (hard)
                         (*limits [i].limit)->rlim_max = lim;
-                } else
+                }
+                else
                     warn ("Unable to process %s limit: Not supported\n", 
                           limits [i].name);
                 break;
@@ -407,15 +408,6 @@
     show_usage (1);
 }
 
-/**
-   Parses command line arguments for switches and options.
-
-   @param argc number of command line arguments.
-   @param argv command line arguments.
-   @param defaults target_status structure containing default values.
-   @param exe_opts handle to default child process arguments string
-   @return number of command line arguments parsed.
-*/
 int 
 eval_options (int argc, char **argv, struct target_opts* defaults, 
               const char** exe_opts)
@@ -591,20 +583,6 @@
     return i;
 }
 
-/**
-   Translates opts into an array that can be passed to exec().
-
-   This method malloc ()s two blocks of memory.  The first block is the 
-   generated argv index array.  This is the return value of this method.  The 
-   second block is the parsed and split string contents the index referenced.  
-   This block is stored in element 1 of the return array.  It is the 
-   responsibility of the calling method to free () both blocks.
-
-   @warning this logic is UTF-8 unsafe
-   @warning I/O redirection command piping isn't supported in the parse logic
-   @param opts option string to split
-   @return the parsed argv array
-*/
 char**
 split_opt_string (const char* opts)
 {

Modified: incubator/stdcxx/trunk/util/cmdopt.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/cmdopt.h?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/cmdopt.h (original)
+++ incubator/stdcxx/trunk/util/cmdopt.h Mon Oct  2 16:08:06 2006
@@ -35,13 +35,33 @@
 extern const char suffix_sep; /**< File suffix seperator. */
 extern const size_t exe_suffix_len; /**< Length of executable suffix. */
 
-void 
-show_usage (int status);
+/**
+   Parses command line arguments for switches and options.
 
+   @param argc number of command line arguments.
+   @param argv command line arguments.
+   @param defaults target_status structure containing default values.
+   @param exe_opts handle to default child process arguments string
+   @return number of command line arguments parsed.
+*/
 int 
 eval_options (int argc, char** argv, struct target_opts* defaults, 
               const char** exe_opts);
 
+/**
+   Translates opts into an array that can be passed to exec().
+
+   This method malloc ()s two blocks of memory.  The first block is the 
+   generated argv index array.  This is the return value of this method.  The 
+   second block is the parsed and split string contents the index referenced.  
+   This block is stored in element 1 of the return array.  It is the 
+   responsibility of the calling method to free () both blocks.
+
+   @warning this logic is UTF-8 unsafe
+   @warning I/O redirection command piping isn't supported in the parse logic
+   @param opts option string to split
+   @return the parsed argv array
+*/
 char**
 split_opt_string (const char* opts);
 
@@ -56,4 +76,4 @@
 */
 const char* get_target ();
 
-#endif   // RW_PARSE_OPTS_H
+#endif   /* RW_PARSE_OPTS_H */

Modified: incubator/stdcxx/trunk/util/display.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/display.cpp?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/display.cpp (original)
+++ incubator/stdcxx/trunk/util/display.cpp Mon Oct  2 16:08:06 2006
@@ -35,20 +35,30 @@
 
 #include "display.h"
 
-void print_header_plain ()
+/**
+   Generates output header, designed for text output and console viewing.
+*/
+static void print_header_plain ()
 {
     puts ("NAME                      STATUS ASSERTS FAILED PERCNT    USER     "
           "SYS");
 }
 
-void print_target_plain (const struct target_opts*)
+/**
+   Generates target name listing, designed for text output and console viewing.
+*/
+static void print_target_plain (const struct target_opts*)
 {
     const char* const target_name = get_target ();
     printf ("%-25.25s ", target_name);
     fflush (stdout);
 }
 
-void print_status_plain (const struct target_status* status)
+/**
+   Generates target result listing, designed for text output and console 
+   viewing.
+*/
+static void print_status_plain (const struct target_status* status)
 {
     unsigned valid_timing;
     assert (0 != status);
@@ -85,7 +95,11 @@
 
 }
 
-void print_footer_plain () {}
+/**
+   Placholder output footer function, unneeded for text output and console 
+   viewing.
+*/
+static void print_footer_plain () {}
 
 const char* const short_st_name [ST_LAST] = {
     "OK", /*ST_OK*/

Modified: incubator/stdcxx/trunk/util/display.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/display.h?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/display.h (original)
+++ incubator/stdcxx/trunk/util/display.h Mon Oct  2 16:08:06 2006
@@ -96,4 +96,4 @@
 */
 extern void (*print_footer) ();
 
-#endif   // RW_DISPLAY_H
+#endif   /* RW_DISPLAY_H */

Modified: incubator/stdcxx/trunk/util/exec.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/exec.cpp?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/exec.cpp (original)
+++ incubator/stdcxx/trunk/util/exec.cpp Mon Oct  2 16:08:06 2006
@@ -24,8 +24,8 @@
  * 
  **************************************************************************/
 
-// disable Compaq/HP C++ pure libc headers to allow POSIX symbols
-// such as SIGALRM or SIGKILL to be defined
+/* disable Compaq/HP C++ pure libc headers to allow POSIX symbols
+   such as SIGALRM or SIGKILL to be defined. */
 #undef __PURE_CNAME
 
 #include <assert.h> /* for assert */
@@ -291,19 +291,6 @@
     return delta;
 }
 
-/**
-   Translates a human understandable signal name into a number usable by kill ().
-
-   This method understands several formats for signal names.  They are as follows:
-   - n
-   - SIGFOO
-   - FOO
-   In this list, n denotes a number and FOO denotes a short signal name.
-
-   @param signame a signal name to decode
-   @returns the signal number or -1 if a number couldn't be determined
-   @see signal_names []
-*/
 int
 get_signo (const char* signame)
 {
@@ -312,7 +299,7 @@
 
     assert (0 != signame);
 
-    if (isdigit (signame [0])){
+    if (isdigit (signame [0])) {
         char *junk;
         int trans = strtol (signame, &junk, 10);
 
@@ -336,15 +323,6 @@
     return -1;
 }
 
-/**
-   Translates a signal number into a human understandable name
-
-   @param signo a signal number
-   @returns the human understandable name for the signal (minus the SIG 
-   prefix), or "#n" if the the name for the number is unknown to the 
-   function, where n is signo
-   @see signal_names []
-*/
 const char* 
 get_signame (int signo)
 {
@@ -464,11 +442,13 @@
                     break;
                 }
                 break; /*we've got an exit state, so let's bail*/
-            } else if (WIFSIGNALED (status)) {
+            }
+            else if (WIFSIGNALED (status)) {
                 result->exit = WTERMSIG (status);
                 result->signaled = 1;
                 break; /*we've got an exit state, so let's bail*/
-            } else if (WIFSTOPPED (status))
+            }
+            else if (WIFSTOPPED (status))
                 stopped = status;
 #ifdef WIFCONTINUED /*Perhaps we should guard WIFSTOPPED with this guard also */
             else if (WIFCONTINUED (status))
@@ -490,7 +470,7 @@
                     break;
                 }
 
-                if(0 != kill (-child_pid, signals [siginx])) {
+                if (0 != kill (-child_pid, signals [siginx])) {
                     if (ESRCH == errno)
                         /* ESRCH means 'No process (group) found'.  Since 
                            there aren't any processes in the process group, 
@@ -518,8 +498,7 @@
                        them like EPERM or EINVAL at this time. */
                 }
 
-                /* Record the signal used*/
-                /* result->killed = signals [siginx];*/
+                /* Consider recording the signal used here.*/
 
                 ++siginx;
 
@@ -574,7 +553,7 @@
        process times are rolled into the timing of a later process */
     while (siginx < sigcount && 0 == kill (-child_pid, signals [siginx])) {
         ++siginx;
-        sleep(1);
+        sleep (1);
     }
 }
 
@@ -712,25 +691,25 @@
     } limits[] = {
 #ifdef RLIMIT_CORE
         LIMIT (CORE, core),
-#endif   // RLIMIT_CORE
+#endif   /* RLIMIT_CORE */
 #ifdef RLIMIT_CPU
         LIMIT (CPU, cpu),
-#endif   // RLIMIT_CPU
+#endif   /* RLIMIT_CPU */
 #ifdef RLIMIT_DATA
         LIMIT (DATA, data),
-#endif   // RLIMIT_DATA
+#endif   /* RLIMIT_DATA */
 #ifdef RLIMIT_FSIZE
         LIMIT (FSIZE, fsize),
-#endif   // RLIMIT_FSIZE
+#endif   /* RLIMIT_FSIZE */
 #ifdef RLIMIT_NOFILE
         LIMIT (NOFILE, nofile),
-#endif   // RLIMIT_NOFILE
+#endif   /* RLIMIT_NOFILE */
 #ifdef RLIMIT_STACK
         LIMIT (STACK, stack),
-#endif   // RLIMIT_STACK
+#endif   /* RLIMIT_STACK */
 #ifdef RLIMIT_AS
         LIMIT (AS, as),
-#endif   // RLIMIT_AS    
+#endif   /* RLIMIT_AS */    
         { 0, 0, 0 }
     };
 
@@ -811,21 +790,6 @@
 #endif /* _XOPEN_UNIX */
 }
 
-/**
-   Entry point to the child process (watchdog) subsystem.
-
-   This method fork ()s, creating a child process.  This child process becomes
-   a process group leader, redirects input and output files, then exec ()s
-   the target specified in argv [0], providing it with argv to use as its argv 
-   array.  Meanwhile, the parent process calls the wait_for_child method to
-   monitor the child process, passing the return value back to the calling
-   method.
-
-   @param exec_name name of the child executable
-   @param argv argv array for child process
-   @return structure describing how the child procees exited
-   @see wait_for_child ()
-*/
 void exec_file (const struct target_opts* options, struct target_status* result)
 {
     const pid_t child_pid = fork ();
@@ -905,7 +869,8 @@
         result->status = ST_EXECUTE;
         warn ("Unable to create child process for %s: %s\n", options->argv [0],
               strerror (errno));
-    } else {
+    }
+    else {
         /* parent */
         wait_for_child (child_pid, options->timeout, result);
         calculate_usage (result);
@@ -1107,23 +1072,6 @@
         warn_last_error ("Waiting for child process");
 }
 
-/**
-   Entry point to the child process (watchdog) subsystem.
-
-   This method creates a process using the windows CreateProcess API call.
-   The startup context for this process is based on the context of the exec
-   utility, but with the standard * file handles redirected.  The execution of
-   the process is monitored with the WaitForSingleObject API call.  If the 
-   process doesn't complete within the allowed timeout, it is then killed.  On 
-   Windows NT systems, a soft kill of the process (via the 
-   GenerateConsoleCtrlEvent API call) are first attempted attempted.  The 
-   process is then hard killed via the TerminateProcess API call.
-
-   @param exec_name name of the child executable
-   @param argv argv array for child process
-   @return structure describing how the child procees exited
-   @see wait_for_child ()
-*/
 void exec_file (const struct target_opts* options, struct target_status* result)
 {
     char* merged;

Modified: incubator/stdcxx/trunk/util/exec.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/exec.h?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/exec.h (original)
+++ incubator/stdcxx/trunk/util/exec.h Mon Oct  2 16:08:06 2006
@@ -29,10 +29,56 @@
 
 #include "target.h" /* For struct target_opts */
 
+/**
+   Translates a human understandable signal name into a number usable by kill ().
+
+   This method understands several formats for signal names.  They are as follows:
+   - n
+   - SIGFOO
+   - FOO
+   In this list, n denotes a number and FOO denotes a short signal name.
+
+   @param signame a signal name to decode
+   @returns the signal number or -1 if a number couldn't be determined
+   @see signal_names []
+*/
 int get_signo (const char* signame);
 
+/**
+   Translates a signal number into a human understandable name
+
+   @param signo a signal number
+   @returns the human understandable name for the signal (minus the SIG 
+   prefix), or "#n" if the the name for the number is unknown to the 
+   function, where n is signo
+   @see signal_names []
+*/
 const char* get_signame (int signo);
 
+/**
+   Entry point to the child process (watchdog) subsystem.
+
+   On UNIX systems, this method fork ()s, creating a child process.  This 
+   child process becomes a process group leader, redirects input and output 
+   files, then exec ()s the target specified in argv [0], providing it with 
+   argv to use as its argv array.  Meanwhile, the parent process calls the 
+   wait_for_child method to monitor the child process, passing the return 
+   value back to the calling method.
+
+   On Windows, this method creates a process using the windows CreateProcess 
+   API call. The startup context for this process is based on the context of 
+   the exec utility, but with the standard * file handles redirected.  The 
+   execution of the process is monitored with the WaitForSingleObject API 
+   call.  If the process doesn't complete within the allowed timeout, it is 
+   then killed.  On Windows NT systems, a soft kill of the process (via the 
+   GenerateConsoleCtrlEvent API call) are first attempted attempted.  The 
+   process is then hard killed via the TerminateProcess API call.
+
+   @param exec_name name of the child executable
+   @param argv argv array for child process
+   @return structure describing how the child procees exited
+   @see wait_for_child ()
+*/
 void exec_file (const struct target_opts* options, struct target_status* result);
 
-#endif   // RW_EXEC_H
+#endif   /* RW_EXEC_H */

Modified: incubator/stdcxx/trunk/util/output.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/output.cpp?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/output.cpp (original)
+++ incubator/stdcxx/trunk/util/output.cpp Mon Oct  2 16:08:06 2006
@@ -296,18 +296,6 @@
     free (ref_name);
 }
 
-/**
-   Umbrella (dispatch) function to analyse the (saved) output of target.
-
-   This file opens the saved output for parsing.  If this fails, 
-   the status structure is updated to reflect this.  Otherwise, check_test (),
-   check_compat_test (), or check_example () is called to parse the output
-   file.
-
-   @param target the path to the executable that generated the output file 
-   being parsed.
-   @param status status object to record results in.
-*/
 void
 parse_output (const struct target_opts* options, struct target_status* status)
 {

Modified: incubator/stdcxx/trunk/util/output.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/output.h?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/output.h (original)
+++ incubator/stdcxx/trunk/util/output.h Mon Oct  2 16:08:06 2006
@@ -27,7 +27,19 @@
 #ifndef OUTPUT_H
 #define OUTPUT_H
 
+/**
+   Umbrella (dispatch) function to analyse the (saved) output of target.
+
+   This file opens the saved output for parsing.  If this fails, 
+   the status structure is updated to reflect this.  Otherwise, check_test (),
+   check_compat_test (), or check_example () is called to parse the output
+   file.
+
+   @param target the path to the executable that generated the output file 
+   being parsed.
+   @param status status object to record results in.
+*/
 void
 parse_output (const struct target_opts* options, struct target_status* status);
 
-#endif   // OUTPUT_H
+#endif   /* OUTPUT_H */

Modified: incubator/stdcxx/trunk/util/runall.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/runall.cpp?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/runall.cpp (original)
+++ incubator/stdcxx/trunk/util/runall.cpp Mon Oct  2 16:08:06 2006
@@ -49,19 +49,19 @@
 
 #ifndef ENOENT
 #  define ENOENT 2
-#endif   // ENOENT
+#endif   /* ENOENT */
 
 #ifndef S_IXUSR
 #  define S_IXUSR 0100
-#endif   // S_IXUSR
+#endif   /* S_IXUSR */
 
 #ifndef S_IXGRP
 #  define S_IXGRP 0010
-#endif   // S_IXGRP
+#endif   /* S_IXGRP */
 
 #ifndef S_IXOTH
 #  define S_IXOTH 0001
-#endif   // S_IXOTH
+#endif   /* S_IXOTH */
 
 /**
    Utility function to rework the argv array

Modified: incubator/stdcxx/trunk/util/target.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/target.h?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/target.h (original)
+++ incubator/stdcxx/trunk/util/target.h Mon Oct  2 16:08:06 2006
@@ -42,7 +42,7 @@
    Abstraction typedef for struct timeval using real struct
 */
 typedef struct timeval rw_timeval;
-#else
+#else /* _XOPEN_UNIX */
 /**
    Placeholder rlim_t for use in rw_rlimit
 */
@@ -77,7 +77,7 @@
    Abstraction typedef for struct timeval using placeholder struct
 */
 typedef struct rw_timeval rw_timeval;
-#endif
+#endif /* _XOPEN_UNIX */
 
 #ifndef RLIM_INFINITY
 #  define RLIM_INFINITY -1

Modified: incubator/stdcxx/trunk/util/util.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/util.cpp?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/util.cpp (original)
+++ incubator/stdcxx/trunk/util/util.cpp Mon Oct  2 16:08:06 2006
@@ -50,12 +50,6 @@
     va_end (args);
 }
 
-/**
-   Wrapper for exit (), providing a terminal error message on stderr.
-
-   @param state non-zero status code to exit () with
-   @param format printf () format string to display on stderr
-*/
 void
 terminate (const int state, const char* const format, ...)
 {
@@ -77,14 +71,6 @@
     exit (state);
 }
 
-/**
-   Wrapper for malloc (), providing return value checking.
-
-   @param size number of bytes of memory to allocate
-   @param file name of file calling method
-   @param line line number in file method was called from
-   @return (non-null) pointer to allocated bock of memory
-*/
 void*
 guarded_malloc (const size_t size, const char* const file, const unsigned line)
 {
@@ -102,15 +88,6 @@
     return alloc;
 }
 
-/**
-   Wrapper for realloc(), providing return value checking.
-
-   @param source pointer to memory block to reallocate
-   @param size number of bytes of memory to allocate
-   @param file name of file calling method
-   @param line line number in file method was called from
-   @return (non-null) pointer to allocated bock of memory
-*/
 void*
 guarded_realloc (void* source, const size_t size, const char* const file, 
                  const unsigned line)
@@ -122,8 +99,8 @@
 
     alloc = realloc (source, size);
 
-    if ( 0 == alloc )
-        terminate ( 1, "malloc(%lu) at line %u of %s failed: %s\n", 
+    if (0 == alloc)
+        terminate (1, "malloc(%lu) at line %u of %s failed: %s\n", 
                  (unsigned long)size, line, file, strerror (errno));
 
     return alloc;

Modified: incubator/stdcxx/trunk/util/util.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/util.h?view=diff&rev=452253&r1=452252&r2=452253
==============================================================================
--- incubator/stdcxx/trunk/util/util.h (original)
+++ incubator/stdcxx/trunk/util/util.h Mon Oct  2 16:08:06 2006
@@ -34,7 +34,13 @@
 */
 void warn (const char* const format, ...);
 
-void terminate ( const int state, const char* const format, ... );
+/**
+   Wrapper for exit (), providing a terminal error message on stderr.
+
+   @param state non-zero status code to exit () with
+   @param format printf () format string to display on stderr
+*/
+void terminate (const int state, const char* const format, ...);
 
 /* Note: RW_MALLOC should be used rather than malloc within the runall 
    utility.  This macro calls the guarded_malloc function which performs 
@@ -44,11 +50,28 @@
 
 #define RW_MALLOC(size)                             \
     guarded_malloc(size, __FILE__, __LINE__)
+/**
+   Wrapper for malloc (), providing return value checking.
+
+   @param size number of bytes of memory to allocate
+   @param file name of file calling method
+   @param line line number in file method was called from
+   @return (non-null) pointer to allocated bock of memory
+*/
 void* guarded_malloc (const size_t size, const char* const file, 
                       const unsigned line);
 
 #define RW_REALLOC(source, size)                 \
     guarded_realloc(source, size, __FILE__, __LINE__)
+/**
+   Wrapper for realloc(), providing return value checking.
+
+   @param source pointer to memory block to reallocate
+   @param size number of bytes of memory to allocate
+   @param file name of file calling method
+   @param line line number in file method was called from
+   @return (non-null) pointer to allocated bock of memory
+*/
 void* guarded_realloc (void* source, const size_t size, 
                        const char* const file, const unsigned line);
 
@@ -74,4 +97,4 @@
    @return translation of 'target.out'
 */
 char* output_name (const char* target);
-#endif   // RW_UTIL_H
+#endif   /* RW_UTIL_H */



Mime
View raw message