gbranden pushed a commit to branch master
in repository groff.
commit d0dbd125350b03b2e79d0b7817317a4eba85876b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Apr 12 01:21:34 2026 -0500
src/libs/libdriver/printer.cpp: Fix cosmetic nit.
...in code style. Unapply indentation to preprocessor-bracketed code,
consistently with (most of) the rest of groff.
Also annotate null pointer with `nullptr` comment to ease any future
transition to C++11, which defines it as a keyword.
---
src/libs/libdriver/printer.cpp | 67 +++++++++++++++++++++---------------------
1 file changed, 34 insertions(+), 33 deletions(-)
diff --git a/src/libs/libdriver/printer.cpp b/src/libs/libdriver/printer.cpp
index ecfe965ee..c65a45e2f 100644
--- a/src/libs/libdriver/printer.cpp
+++ b/src/libs/libdriver/printer.cpp
@@ -48,41 +48,40 @@ with this program. If not, see
<http://www.gnu.org/licenses/>.
#if (defined(_MSC_VER) || defined(_WIN32)) \
&& !defined(__CYGWIN__) && !defined(_UWIN)
- /* Native MS-Windows doesn't know about SIGPIPE, so we cannot detect
- the early exit from the pager, and therefore, cannot clean up the
- error context; thus we use the following static function to
- identify this particular error context, and so suppress unwanted
- diagnostics.
- */
-
- static int check_for_output_error(FILE* stream)
- {
- /* First, clean up any prior error context on the output stream */
- if (ferror (stream))
- clearerr (stream);
- /* Clear errno, in case clearerr() and fflush() don't */
- errno = 0;
- /* Flush the output stream, so we can capture any error context,
- other than the specific case we wish to suppress.
-
- Microsoft doesn't document it, but the error code for the
- specific context we are trying to suppress seems to be EINVAL --
- a strange choice, since it is not normally associated with
- fflush(); of course, it *should* be EPIPE, but this *definitely*
- is not used, and *is* so documented.
- */
- return ((fflush(stream) < 0) && (errno != EINVAL));
- }
+ /* Native MS Windows doesn't know about SIGPIPE, so we cannot detect
+ the early exit from the pager, and therefore, cannot clean up the
+ error context; thus we use the following static function to identify
+ this particular error context, and so suppress unwanted diagnostics.
+ */
+
+ static int check_for_output_error(FILE* stream)
+ {
+ /* First, clean up any prior error context on the output stream. */
+ if (ferror (stream))
+ clearerr (stream);
+ /* Clear errno, in case clearerr() and fflush() don't. */
+ errno = 0;
+ /* Flush the output stream, so we can capture any error context,
+ other than the specific case we wish to suppress.
+
+ Microsoft doesn't document it, but the error code for the specific
+ context we are trying to suppress seems to be EINVAL -- a strange
+ choice, since it is not normally associated with fflush(); of
+ course, it *should* be EPIPE, but this *definitely* is not used,
+ and *is* so documented.
+ */
+ return ((fflush(stream) < 0) && (errno != EINVAL));
+ }
#else
- /* For other systems, we simply assume that *any* output error context
- is to be reported.
- */
- static inline int check_for_output_error(FILE* stream)
- {
- return (ferror(stream) || (fflush(stream) < 0));
- }
+/* For other systems, we simply assume that *any* output error context
+ is to be reported.
+*/
+static inline int check_for_output_error(FILE* stream)
+{
+ return (ferror(stream) || (fflush(stream) < 0));
+}
#endif
@@ -142,7 +141,9 @@ void printer::load_font(int n, const char *nm)
font *printer::find_font(const char *nm)
{
- for (font_pointer_list *p = font_list; p; p = p->next)
+ for (font_pointer_list *p = font_list;
+ p != 0 /* nullptr */;
+ p = p->next)
if (strcmp(p->p->get_filename(), nm) == 0)
return p->p;
font *f = make_font(nm);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit