gbranden pushed a commit to branch master
in repository groff.
commit e112c2e9b11867c99765d248406a4a4414d13e96
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Jul 13 03:38:51 2024 -0500
[troff]: Boolify `set_location()` member function.
...and those of its derived classes.
* src/roff/troff/input.cpp (class input_iterator, class file_iterator)
(class input_stack, file_iterator::set_location)
(input_stack::set_location): Demote return type from `int` to `bool`.
(file_iterator::set_location, input_stack::set_location): Return
Boolean instead of integer literals.
---
ChangeLog | 13 +++++++++++++
src/roff/troff/input.cpp | 16 ++++++++--------
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 12b3bb0a9..994b72108 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-07-13 G. Branden Robinson <[email protected]>
+
+ [troff]: Boolify `set_location()` member function and those of
+ its derived classes.
+
+ * src/roff/troff/input.cpp (class input_iterator)
+ (class file_iterator, class input_stack)
+ (file_iterator::set_location):
+ (input_stack::set_location): Demote return type from `int` to
+ `bool`.
+ (file_iterator::set_location, input_stack::set_location): Return
+ Boolean instead of integer literals.
+
2024-07-13 G. Branden Robinson <[email protected]>
* src/preproc/soelim/soelim.cpp (do_file): Stop "normalizing"
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index d113371a8..e460b7340 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -330,7 +330,7 @@ private:
virtual int get_break_flag() { return 0; }
virtual int get_location(int, const char **, int *) { return 0; }
virtual void backtrace() {}
- virtual int set_location(const char *, int) { return 0; }
+ virtual bool set_location(const char *, int) { return 0; }
virtual int next_file(FILE *, const char *) { return 0; }
virtual void shift(int) {}
virtual int is_boundary() {return 0; }
@@ -392,7 +392,7 @@ public:
int peek();
int get_location(int, const char **, int *);
void backtrace();
- int set_location(const char *, int);
+ bool set_location(const char *, int);
int next_file(FILE *, const char *);
int is_file();
};
@@ -510,7 +510,7 @@ void file_iterator::backtrace()
errprint("backtrace: %3 '%1':%2\n", f, n, popened ? "pipe" : "file");
}
-int file_iterator::set_location(const char *f, int ln)
+bool file_iterator::set_location(const char *f, int ln)
{
if (f) {
filename = f;
@@ -519,7 +519,7 @@ int file_iterator::set_location(const char *f, int ln)
the_output->put_filename(f, 0);
}
lineno = ln;
- return 1;
+ return true;
}
input_iterator nil_iterator;
@@ -536,7 +536,7 @@ public:
static int get_break_flag();
static int nargs();
static int get_location(int, const char **, int *);
- static int set_location(const char *, int);
+ static bool set_location(const char *, int);
static void backtrace();
static void next_file(FILE *, const char *);
static void end_file();
@@ -804,12 +804,12 @@ void input_stack::backtrace()
p->backtrace();
}
-int input_stack::set_location(const char *filename, int lineno)
+bool input_stack::set_location(const char *filename, int lineno)
{
for (input_iterator *p = top; p; p = p->next)
if (p->set_location(filename, lineno))
- return 1;
- return 0;
+ return true;
+ return false;
}
void input_stack::next_file(FILE *fp, const char *s)
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit