[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 10/17: [troff]: Fix code style nit (no nullptr punning).
From: |
G. Branden Robinson |
Subject: |
[groff] 10/17: [troff]: Fix code style nit (no nullptr punning). |
Date: |
Sun, 3 Nov 2024 02:14:23 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit ec51b08634413bd6d542b9d23a652281593c0a93
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Oct 29 21:57:52 2024 -0500
[troff]: Fix code style nit (no nullptr punning).
* src/roff/troff/env.cpp (select_hyphenation_language)
(add_hyphenation_exceptions, hyphenate)
(read_hyphenation_patterns_from_file): Explicitly compare variable of
pointer type to null pointer literal instead of letting it pun down to
a Boolean.
---
ChangeLog | 8 ++++++++
src/roff/troff/env.cpp | 11 ++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7f4729352..016cd2766 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-10-29 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/env.cpp (select_hyphenation_language)
+ (add_hyphenation_exceptions, hyphenate)
+ (read_hyphenation_patterns_from_file): Fix code style nit:
+ explicitly compare variable of pointer type to null pointer
+ literal instead of letting it pun down to a Boolean.
+
2024-10-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: The `pcolor` request now accepts color identifiers as
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 33f51d10e..7858f081b 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3707,7 +3707,7 @@ static void select_hyphenation_language()
symbol nm = get_name();
if (!nm.is_null()) {
current_language = (hyphenation_language *)language_dictionary.lookup(nm);
- if (!current_language) {
+ if (0 /* nullptr */ == current_language) {
current_language = new hyphenation_language(nm);
(void)language_dictionary.lookup(nm, (void *)current_language);
}
@@ -3726,7 +3726,7 @@ static void add_hyphenation_exceptions()
skip_line();
return;
}
- if (!current_language) {
+ if (0 /* nullptr */ == current_language) {
error("cannot add hyphenation exceptions when no hyphenation"
" language is set");
skip_line();
@@ -4184,7 +4184,8 @@ public:
const char *hyphenation_language_reg::get_string()
{
- return current_language ? current_language->name.contents() : "";
+ return (current_language != 0 /* nullptr */)
+ ? current_language->name.contents() : "";
}
class hyphenation_default_mode_reg : public reg {
@@ -4352,7 +4353,7 @@ void init_env_requests()
void hyphenate(hyphen_list *h, unsigned flags)
{
- if (!current_language)
+ if (0 /* nullptr */ == current_language)
return;
while (h != 0 /* nullptr */) {
while ((h != 0 /* nullptr */) && (0 == h->hyphenation_code))
@@ -4470,7 +4471,7 @@ static void read_hyphenation_patterns_from_file(bool
append)
// TODO: Read a file name, not a groff identifier.
symbol name = get_long_name(true /* required */);
if (!name.is_null()) {
- if (!current_language)
+ if (0 /* nullptr */ == current_language)
error("no current hyphenation language");
else
current_language->patterns.read_patterns_file(
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 10/17: [troff]: Fix code style nit (no nullptr punning).,
G. Branden Robinson <=