groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 27/80: [hpftodit]: Fix code style nits.


From: G. Branden Robinson
Subject: [groff] 27/80: [hpftodit]: Fix code style nits.
Date: Sat, 30 Nov 2024 04:02:17 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 7ee15ff4c05182acc5e7f219273fade439f4712e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 27 14:18:16 2024 -0600

    [hpftodit]: Fix code style nits.
    
    * src/utils/hpftodit/hpftodit.cpp:
    * src/utils/hpftodit/hpuni.cpp: Align with modern groff conventions.
      Add Autoconf "<config.h>"-inclusion boilerplate to these translation
      units.  Include system library headers before local ones.
    
    * src/utils/hpftodit/hpftodit.cpp: Use standard symbol `EXIT_SUCCESS`
      instead of zero literal.  Drop inclusion of "<ctype.h>"; none of its
      symbols (`is*()`) are directly used.
---
 ChangeLog                       | 12 ++++++++++++
 src/utils/hpftodit/hpftodit.cpp | 22 ++++++++++++----------
 src/utils/hpftodit/hpuni.cpp    | 14 ++++++++++++--
 3 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 75c812db8..1c3c8d0cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-11-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/utils/hpftodit/hpftodit.cpp:
+       * src/utils/hpftodit/hpuni.cpp: Align with modern groff
+       conventions.  Add Autoconf "<config.h>"-inclusion boilerplate to
+       these translation units.  Include system library headers before
+       local ones.
+
+       * src/utils/hpftodit/hpftodit.cpp: Use standard symbol
+       `EXIT_SUCCESS` instead of zero literal.  Drop inclusion of
+       "<ctype.h>"; none of its symbols (`is*()`) are directly used.
+
 2024-11-27  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [troff]: Align with modern groff conventions.
diff --git a/src/utils/hpftodit/hpftodit.cpp b/src/utils/hpftodit/hpftodit.cpp
index c816f5fac..d765fd780 100644
--- a/src/utils/hpftodit/hpftodit.cpp
+++ b/src/utils/hpftodit/hpftodit.cpp
@@ -23,19 +23,21 @@ option to specify symbol sets to look in
 put filename in error messages (or fix lib)
 */
 
-#include "lib.h"
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 #include <assert.h>
-#include <ctype.h>
 #include <errno.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <math.h> // cos(), sin()
+#include <stdio.h> // FILE, fclose(), fgets(), fopen(), fprintf(),
+                  // freopen(), printf(), sprintf()
+#include <stdlib.h> // atoi(), exit(), EXIT_FAILURE, EXIT_SUCCESS,
+                   // strtol()
+#include <string.h> // strchr(), strcmp(), strerror(), strlen(),
+                   // strrchr(), strtok()
+
+#include "lib.h"
 
 #include "posix.h"
 #include "errarg.h"
@@ -319,11 +321,11 @@ main(int argc, char **argv)
       break;
     case 'v':
       printf("GNU hpftodit (groff) version %s\n", Version_string);
-      exit(0);
+      exit(EXIT_SUCCESS);
       break;
     case CHAR_MAX + 1: // --help
       usage(stdout);
-      exit(0);
+      exit(EXIT_SUCCESS);
       break;
     case '?':
       error("unrecognized command-line option '%1'", char(optopt));
@@ -344,7 +346,7 @@ main(int argc, char **argv)
   if (debug_flag)
     dump_tags(f);
   if (!debug_flag && !read_map(argv[optind + 1], tfm_type))
-    exit(1);
+    exit(EXIT_FAILURE);
   else if (debug_flag && argc - optind > 1)
     read_map(argv[optind + 1], tfm_type);
   current_filename = NULL;
diff --git a/src/utils/hpftodit/hpuni.cpp b/src/utils/hpftodit/hpuni.cpp
index b3f933fbb..b1b17d650 100644
--- a/src/utils/hpftodit/hpuni.cpp
+++ b/src/utils/hpftodit/hpuni.cpp
@@ -1,5 +1,4 @@
-// -*- C++ -*-
-/* Copyright (C) 2003-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2024 Free Software Foundation, Inc.
      Written by Jeff Conrad (jeff_conrad@msn.com)
 
 This file is part of groff.
@@ -17,7 +16,12 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "lib.h"
+
 #include "stringclass.h"
 #include "ptable.h"
 
@@ -695,3 +699,9 @@ const char *hp_msl_to_unicode_code(const char *s)
   hp_msl_to_unicode *result = hp_msl_to_unicode_table.lookup(s);
   return result ? result->value : 0;
 }
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]