[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 08/35: [groff]: Fix code style nits.
From: |
G. Branden Robinson |
Subject: |
[groff] 08/35: [groff]: Fix code style nits. |
Date: |
Mon, 25 Oct 2021 03:32:34 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 52a050c69a85ecb9785303c55b38635478be803f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Oct 23 11:38:50 2021 +1100
[groff]: Fix code style nits.
* src/roff/groff/groff.cpp (main, help): Use standard C library
preprocessor symbols `EXIT_SUCCESS` and `EXIT_FAILURE` instead of 0
and 1 literals, respectively. See commit fa4c27e9, 7 September.
(main): Replace `assert(0)` with a communicative predicate.
---
ChangeLog | 10 ++++++++++
src/roff/groff/groff.cpp | 8 ++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 65944b2..751a827 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,16 @@
2021-10-21 G. Branden Robinson <g.branden.robinson@gmail.com>
+ [groff]: Fix code style nits.
+
+ * src/roff/groff/groff.cpp (main, help): Use standard C library
+ preprocessor symbols `EXIT_SUCCESS` and `EXIT_FAILURE` instead
+ of 0 and 1 literals, respectively. See commit fa4c27e9, 7
+ September.
+ (main): Replace `assert(0)` with a communicative predicate.
+
+2021-10-21 G. Branden Robinson <g.branden.robinson@gmail.com>
+
* src/devices/grotty/tty.cpp (tty_printer::special_link):
Eliminate casts by retyping `uri` and `pair` to pointers to
`const char`s.
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index 66e6483..db7218c 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -327,10 +327,10 @@ int main(int argc, char **argv)
break;
case '?':
usage(stderr);
- exit(1);
+ exit(EXIT_FAILURE);
break;
default:
- assert(0);
+ assert(0 == "no case to handle option character");
break;
}
}
@@ -494,7 +494,7 @@ int main(int argc, char **argv)
if (Vflag)
print_commands(Vflag == 1 ? stdout : stderr);
if (Vflag == 1)
- exit(0);
+ exit(EXIT_SUCCESS);
return run_commands(vflag);
}
@@ -845,7 +845,7 @@ void help()
"\n"
"See groff(1) for details.\n",
stdout);
- exit(0);
+ exit(EXIT_SUCCESS);
}
void usage(FILE *stream)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 08/35: [groff]: Fix code style nits.,
G. Branden Robinson <=