gbranden pushed a commit to branch master
in repository groff.
commit 9e999b595c15e07f841ffd9490eb5927c8707b36
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Mar 25 11:58:20 2026 -0500
[libgroff]: Improve internal organization (2/4).
* src/include/lf.h: Declare `change_filename()` and `change_lineno()`
properly here...
* src/libs/libgroff/lf.cpp: ...instead of here, with `extern`.
* src/libs/libgroff/change_lf.cpp: Use preprocessor to include "lf.h"
and "lib.h" header files. The latter obviates the need for an
`extern` declaration of `strsave()`.
Fixes `-Wmissing-declarations` warning.
---
ChangeLog | 11 +++++++++++
src/include/lf.h | 5 +++++
src/libs/libgroff/change_lf.cpp | 3 ++-
src/libs/libgroff/lf.cpp | 3 ---
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f655825cf..4d812de33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,17 @@
* src/devices/grops/ps.cpp: Drop unnecessary preprocessor
inclusions of "paper.h" header file.
+2026-03-25 G. Branden Robinson <[email protected]>
+
+ * src/include/lf.h: Declare `change_filename()` and
+ `change_lineno()` properly here...
+ * src/libs/libgroff/lf.cpp: ...instead of here, with `extern`.
+ * src/libs/libgroff/change_lf.cpp: Use preprocessor to include
+ "lib.h" header file, also obviating the need for an `extern`
+ declaration of `strsave()`, declared by the same header file.
+
+ Fixes `-Wmissing-declarations` warning.
+
2026-03-25 G. Branden Robinson <[email protected]>
[libgroff]: Boolify and rename static class member variable.
diff --git a/src/include/lf.h b/src/include/lf.h
index 75b851fad..6b932c377 100644
--- a/src/include/lf.h
+++ b/src/include/lf.h
@@ -19,6 +19,11 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include "stringclass.h"
+// libgroff/change_lf.cpp
+void change_filename(const char *);
+void change_lineno(int);
+
+// libgroff/lf.cpp
bool interpret_lf_request_arguments(const char *p);
void normalize_file_name_for_lf_request(string &fn);
diff --git a/src/libs/libgroff/change_lf.cpp b/src/libs/libgroff/change_lf.cpp
index 140329de7..8eb96af40 100644
--- a/src/libs/libgroff/change_lf.cpp
+++ b/src/libs/libgroff/change_lf.cpp
@@ -22,7 +22,8 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include <string.h>
-extern char *strsave(const char *);
+#include "lf.h"
+#include "lib.h" // strsave()
extern const char *current_filename;
extern int current_lineno;
diff --git a/src/libs/libgroff/lf.cpp b/src/libs/libgroff/lf.cpp
index 005377c35..c9a19f878 100644
--- a/src/libs/libgroff/lf.cpp
+++ b/src/libs/libgroff/lf.cpp
@@ -29,9 +29,6 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include "stringclass.h"
#include "lf.h"
-extern void change_filename(const char *);
-extern void change_lineno(int);
-
bool interpret_lf_request_arguments(const char *p)
{
while (*p == ' ')
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit