gbranden pushed a commit to branch master
in repository groff.

commit 7aea5a64fc50175552f49f22e5847212df0377b2
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Jul 13 05:56:06 2024 -0500

    [libgroff]: Slightly refactor (deobfuscate).
    
    * src/libs/libgroff/font.cpp (font::load): Reduce cleverness of
      assignment nested inside conditional--a favorite of C obscurantists
      and an especially gratuitous case since it was preceded by a
      declarator without an initializer.  This aligns the function with
      another overloaded version of itself and with
      `font::scan_papersize()`.
---
 ChangeLog                  | 9 +++++++++
 src/libs/libgroff/font.cpp | 8 ++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 78650bf77..1eaaba6f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-07-13  G. Branden Robinson <[email protected]>
+
+       * src/libs/libgroff/font.cpp (font::load, font::load_desc):
+       Reduce cleverness of assignment nested inside conditional--a
+       favorite of C obscurantists and an especially gratuitous case
+       since it was preceded by a declarator without an initializer.
+       This aligns the function with another overloaded version of
+       itself and with `font::scan_papersize()`.
+
 2024-07-13  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (file_iterator::set_location): Stop
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index e5d834998..a0e9bc2c2 100644
--- a/src/libs/libgroff/font.cpp
+++ b/src/libs/libgroff/font.cpp
@@ -782,9 +782,9 @@ again:
 
 bool font::load(bool load_header_only)
 {
-  FILE *fp;
   char *path;
-  if ((fp = open_file(name, &path)) == 0)
+  FILE *fp = open_file(name, &path);
+  if (fp == 0)
     return false;
   text_file t(fp, path);
   t.silent = load_header_only;
@@ -1071,9 +1071,9 @@ static struct {
 const char *font::load_desc()
 {
   int nfonts = 0;
-  FILE *fp;
   char *path;
-  if ((fp = open_file("DESC", &path)) == 0)
+  FILE *fp = open_file("DESC", &path);
+  if (fp == 0)
     return 0 /* nullptr */;
   text_file t(fp, path);
   while (t.next_line()) {

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to