groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/11: [grohtml]: Fix code nit.


From: G. Branden Robinson
Subject: [groff] 02/11: [grohtml]: Fix code nit.
Date: Sat, 31 Jul 2021 10:36:27 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 1fbaa4062f861892ab062acbe5a7c3e0c970c844
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Jul 30 18:24:53 2021 +1000

    [grohtml]: Fix code nit.
    
    * src/preproc/html/pre-html.cpp (get_image_generator): Type-qualify
      `keyword_len` as `const` to encourage the compiler to compute this
      value (the length of a string literal) at build time.
---
 ChangeLog                     | 9 +++++++++
 src/preproc/html/pre-html.cpp | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f0ebecd..80fa437 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2021-07-30  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       [grohtml]: Fix code nit.
+
+       * src/preproc/html/pre-html.cpp (get_image_generator):
+       Type-qualify `keyword_len` as `const` to encourage the compiler
+       to compute this value (the length of a string literal) at build
+       time.
+
+2021-07-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        [troff]: Slightly refactor.
 
        * src/roff/troff/node.cpp: Add static `image_filename_len` to
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 7f12c1f..bb95bb1 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -321,7 +321,7 @@ static char *get_image_generator(void)
   FILE *f;
   char *generator = 0;
   const char keyword[] = "image_generator";
-  size_t keyword_len = strlen(keyword);
+  const size_t keyword_len = strlen(keyword);
   f = font_path.open_file(devhtml_desc, &pathp);
   if (0 == f)
     fatal("cannot open file '%1'", devhtml_desc);



reply via email to

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