HomeFreeBSD

indent(1): Untangle the connection between pr_comment.c and io.c.

Description

indent(1): Untangle the connection between pr_comment.c and io.c.

It's pr_comment.c that should decide whether to put a "star comment
continuation" or not. This duplicates code a bit, but it simplifies
pr_comment() at the same time since pr_comment() no longer has to "signal"
whether a star continuation is needed or not.

This change requires indent(1) to not wrap comment lines that lack a blank
character, but I think it's for the better if you look at cases when that
happens (mostly long URIs and file system paths, which arguably shouldn't
be wrapped).

It also fixes two bugs:

  1. Cases where asterisk is a part of the comment's content (like in "*we*

are the champions") and happens to appear at the beginning of the line,
misleading dump_line() into thinking that this is part of the star comment
continuation, leading to misalignment.

  1. Cases where blank starred lines had three too many characters on the

line when wrapped.

Reference:
https://github.com/pstef/freebsd_indent/commit/3b41ee78aafafc7c3e662b794835e3253218dbb3

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Submitted by: Piotr Stefaniak

Details

Provenance
pfgAuthored on
Parents
rS303597: indent(1): Fix wrapping of some lines in comments.
Branches
Unknown
Tags
Unknown