The NetBSD Project

CVS log for src/usr.bin/indent/io.c

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / indent

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.235: download - view: text, markup, annotated - select for diffs
Sun Dec 3 21:44:42 2023 UTC (12 months, 1 week ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, HEAD
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +13 -13 lines
indent: inline input-related macros

No binary change.

Revision 1.234: download - view: text, markup, annotated - select for diffs
Sun Dec 3 21:40:44 2023 UTC (12 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.233: preferred, colored
Changes since revision 1.233: +5 -6 lines
indent: group input-related variables into a struct

No functional change.

Revision 1.233: download - view: text, markup, annotated - select for diffs
Sun Dec 3 21:03:58 2023 UTC (12 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.232: preferred, colored
Changes since revision 1.232: +4 -2 lines
indent: use line number of the token start in diagnostics

Previously, the line number of the end of the token was used, which was
confusing in debug mode.

Revision 1.232: download - view: text, markup, annotated - select for diffs
Tue Jun 27 04:41:23 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.231: preferred, colored
Changes since revision 1.231: +4 -6 lines
indent: fix 'blank line above first statement in function body'

Revision 1.231: download - view: text, markup, annotated - select for diffs
Mon Jun 26 20:03:09 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.230: preferred, colored
Changes since revision 1.230: +10 -2 lines
indent: implement 'blank line above first statement in function body'

Revision 1.230: download - view: text, markup, annotated - select for diffs
Mon Jun 26 14:54:40 2023 UTC (17 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.229: preferred, colored
Changes since revision 1.229: +4 -3 lines
indent: in -bad mode, don't add a blank line above a comment or '}'

Revision 1.229: download - view: text, markup, annotated - select for diffs
Sat Jun 17 23:03:20 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.228: preferred, colored
Changes since revision 1.228: +3 -4 lines
indent: clean up

Extract duplicate code for handling line continuations.

Prevent theoretic undefined behavior in strspn, as inp.s is not
null-terminated.

Remove adding extra space characters when processing comments, as these
are not necessary to force a line of output.

No functional change.

Revision 1.228: download - view: text, markup, annotated - select for diffs
Sat Jun 17 22:28:49 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +30 -24 lines
indent: miscellaneous cleanups

No binary change.

Revision 1.227: download - view: text, markup, annotated - select for diffs
Fri Jun 16 11:48:32 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.226: preferred, colored
Changes since revision 1.226: +7 -6 lines
indent: don't force a blank line between '}' and preprocessing line

Revision 1.226: download - view: text, markup, annotated - select for diffs
Fri Jun 16 11:27:49 2023 UTC (17 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +4 -4 lines
indent: rename a field of the parser state

The previous name 'comment_in_first_line' was misleading, as it could
mean that there was a comment in the first line of the file.

No functional change.

Revision 1.225: download - view: text, markup, annotated - select for diffs
Thu Jun 15 11:27:36 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.224: preferred, colored
Changes since revision 1.224: +17 -6 lines
indent: consolidate handling of statement continuations

Revision 1.224: download - view: text, markup, annotated - select for diffs
Thu Jun 15 10:59:06 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +5 -5 lines
indent: rename state variable to be more accurate

No binary change.

Revision 1.223: download - view: text, markup, annotated - select for diffs
Thu Jun 15 10:34:12 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +2 -5 lines
indent: fix indentation of multi-line enum constant initializers

Revision 1.222: download - view: text, markup, annotated - select for diffs
Thu Jun 15 09:19:06 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +8 -6 lines
indent: miscellaneous cleanups, more tests for edge cases

Revision 1.221: download - view: text, markup, annotated - select for diffs
Wed Jun 14 16:14:30 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +8 -8 lines
indent: clean up array indexing for parser symbols

With 'top' pointing to the actual top element, the array was indexed in
the closed range from 0 to top. All other arrays are indexed by the
usual half-open interval from 0 to len.

No functional change.

Revision 1.220: download - view: text, markup, annotated - select for diffs
Wed Jun 14 14:11:28 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +13 -11 lines
indent: allow more than 20 nested parentheses or brackets

Revision 1.219: download - view: text, markup, annotated - select for diffs
Wed Jun 14 09:57:02 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +5 -3 lines
indent: clean up debugging code

Revision 1.218: download - view: text, markup, annotated - select for diffs
Wed Jun 14 09:31:05 2023 UTC (17 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +8 -6 lines
indent: clean up handling of comments

One less moving part in the parser state.

No functional change.

Revision 1.217: download - view: text, markup, annotated - select for diffs
Sat Jun 10 21:36:38 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +5 -5 lines
indent: rename misleading variable

The name started with 'line_start', but the value is not always the
value from the beginning of the line.

No functional change.

Revision 1.216: download - view: text, markup, annotated - select for diffs
Sat Jun 10 16:43:56 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +17 -17 lines
indent: miscellaneous cleanups

Revision 1.215: download - view: text, markup, annotated - select for diffs
Sat Jun 10 12:59:31 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +10 -8 lines
indent: in debug mode, null-terminate buffers

Revision 1.214: download - view: text, markup, annotated - select for diffs
Sat Jun 10 11:01:58 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +31 -33 lines
indent: distinguish blank lines from newline characters

Revision 1.213: download - view: text, markup, annotated - select for diffs
Sat Jun 10 08:17:04 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +4 -4 lines
indent: fix indentation of continuation lines in initializers

Revision 1.212: download - view: text, markup, annotated - select for diffs
Sat Jun 10 07:53:00 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +41 -38 lines
indent: extract output of an indented line to separate function

Revision 1.211: download - view: text, markup, annotated - select for diffs
Sat Jun 10 07:48:55 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +32 -32 lines
indent: clean up function names and order in output

Revision 1.210: download - view: text, markup, annotated - select for diffs
Sat Jun 10 07:42:41 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +3 -4 lines
indent: clean up function and variable names

Revision 1.209: download - view: text, markup, annotated - select for diffs
Sat Jun 10 06:38:21 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +5 -5 lines
indent: rename and sort variables in parser state

No functional change.

Revision 1.208: download - view: text, markup, annotated - select for diffs
Fri Jun 9 22:01:26 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +33 -4 lines
indent: trim trailing blank lines

Revision 1.207: download - view: text, markup, annotated - select for diffs
Fri Jun 9 08:10:58 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +13 -13 lines
indent: when an indentation is ambiguous, indent one level further

The '-eei' mode now applies whenever the indentation from a multi-line
expression could be confused with a following statement.

Revision 1.206: download - view: text, markup, annotated - select for diffs
Fri Jun 9 07:20:30 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +3 -3 lines
indent: format its own code

Revision 1.205: download - view: text, markup, annotated - select for diffs
Fri Jun 9 06:36:57 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +3 -7 lines
indent: indent multi-line expressions according to parentheses

This reverts the FreeBSD change from 2004-02-12 that had been imported
on 2019-04-04.

Revision 1.204: download - view: text, markup, annotated - select for diffs
Thu Jun 8 20:36:35 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +5 -3 lines
indent: fix indentation in multi-line else-if conditions

Revision 1.203: download - view: text, markup, annotated - select for diffs
Thu Jun 8 06:47:13 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +11 -11 lines
indent: clean up and condense code

No functional change.

Revision 1.202: download - view: text, markup, annotated - select for diffs
Wed Jun 7 15:46:12 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +9 -8 lines
indent: extract the stack of parser symbols to a separate struct

No functional change.

Revision 1.201: download - view: text, markup, annotated - select for diffs
Tue Jun 6 05:27:56 2023 UTC (18 months ago) by rillig
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +7 -9 lines
indent: condense code for writing tabs

No functional change.

Revision 1.200: download - view: text, markup, annotated - select for diffs
Tue Jun 6 05:11:11 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +95 -94 lines
indent: sort functions in call order

No functional change.

Revision 1.199: download - view: text, markup, annotated - select for diffs
Tue Jun 6 04:37:26 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +13 -3 lines
indent: compute indentation of 'case' labels on-demand

One less moving part to keep track of.

No functional change.

Revision 1.198: download - view: text, markup, annotated - select for diffs
Mon Jun 5 12:06:51 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +4 -6 lines
indent: clean up comments

Revision 1.197: download - view: text, markup, annotated - select for diffs
Mon Jun 5 12:01:33 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +3 -4 lines
indent: don't remove blank line after 'if (expr) {'

Revision 1.196: download - view: text, markup, annotated - select for diffs
Mon Jun 5 09:41:40 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +4 -3 lines
indent: fix formatting of 'do' statements

Revision 1.195: download - view: text, markup, annotated - select for diffs
Mon Jun 5 07:23:03 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +4 -9 lines
indent: clean up handling of whitespace

No functional change.

Revision 1.194: download - view: text, markup, annotated - select for diffs
Mon Jun 5 06:43:14 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +27 -31 lines
indent: let the output routines keep track of the indentation

No functional change.

Revision 1.193: download - view: text, markup, annotated - select for diffs
Sun Jun 4 20:51:19 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +20 -19 lines
indent: remove read pointer from buffers that don't need it

The only buffer that needs a read pointer is the current input line in
'inp'.

No functional change.

Revision 1.192: download - view: text, markup, annotated - select for diffs
Sun Jun 4 18:58:30 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +6 -4 lines
indent: force at least one space after the colon of a label

Revision 1.191: download - view: text, markup, annotated - select for diffs
Sun Jun 4 17:54:11 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +3 -3 lines
indent: track the kind of '{' on the parser stack

Revision 1.190: download - view: text, markup, annotated - select for diffs
Sun Jun 4 14:38:15 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +3 -3 lines
indent: ensure that the 'block init level' never goes negative

No functional change.

Revision 1.189: download - view: text, markup, annotated - select for diffs
Sun Jun 4 13:49:00 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +4 -3 lines
indent: fix indentation of initializers in compound expressions

Revision 1.188: download - view: text, markup, annotated - select for diffs
Sun Jun 4 11:09:18 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +5 -9 lines
indent: handle the indentation of 'case' in a simpler way

Revision 1.187: download - view: text, markup, annotated - select for diffs
Tue May 23 18:16:28 2023 UTC (18 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +5 -3 lines
indent: separate code for handling enums from the lexer

The lexer's responsibility is to generate tokens, it's not supposed to
update the parser state.  Centralize the state transitions that control
indentation of enum constants to keep the lexer code clean.

Skip comments, newlines and preprocessing lines when updating the parser
state for enum constants and for '*' in declarations.

Revision 1.186: download - view: text, markup, annotated - select for diffs
Tue May 23 12:12:29 2023 UTC (18 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +3 -3 lines
indent: split debug output into paragraphs

The paragraphs separate the different processing steps: getting a token
from the lexer, processing the token, updating the parser state, sending
a finished line to the output.

Revision 1.185: download - view: text, markup, annotated - select for diffs
Mon May 22 10:28:59 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +23 -4 lines
indent: implement suppressing optional blank lines

Revision 1.184: download - view: text, markup, annotated - select for diffs
Sat May 20 12:05:01 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +4 -3 lines
indent: don't insert blank line between two closing lines

Revision 1.183: download - view: text, markup, annotated - select for diffs
Sat May 20 11:53:53 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +21 -23 lines
indent: extract the output state from the parser state

The parser state depends on the preprocessing lines, the output state
shouldn't.

Revision 1.182: download - view: text, markup, annotated - select for diffs
Sat May 20 11:19:17 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +4 -5 lines
indent: implement blank line above block comment

Revision 1.181: download - view: text, markup, annotated - select for diffs
Sat May 20 10:46:21 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +5 -2 lines
indent: implement blank line after function body

Revision 1.180: download - view: text, markup, annotated - select for diffs
Sat May 20 10:25:47 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +12 -14 lines
indent: ensure that no blank lines are inserted in INDENT OFF mode

No blank lines were inserted previously, but the code looked
suspicious as if that were possible.

Revision 1.179: download - view: text, markup, annotated - select for diffs
Sat May 20 10:09:02 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +44 -16 lines
indent: implement blank lines around conditional compilation

Revision 1.178: download - view: text, markup, annotated - select for diffs
Thu May 18 05:33:27 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +6 -4 lines
indent: manually wrap overly long lines

No functional change.

Revision 1.177: download - view: text, markup, annotated - select for diffs
Thu May 18 04:23:03 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +194 -193 lines
indent: switch to standard code style

Taken from share/misc/indent.pro.

Indent does not wrap code to fit into the line width, it only does so
for comments.  The 'INDENT OFF' sections and too long lines will be
addressed in a follow-up commit.

No functional change.

Revision 1.176: download - view: text, markup, annotated - select for diffs
Thu May 18 03:38:34 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +3 -3 lines
indent: remove unnecessary variable size optimization

Due to the enum that follows in the struct, the short variable was
padded to 4 bytes anyway.

No functional change.

Revision 1.175: download - view: text, markup, annotated - select for diffs
Tue May 16 13:26:26 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +4 -32 lines
indent: directly access the input buffer

No functional change.

Revision 1.174: download - view: text, markup, annotated - select for diffs
Tue May 16 11:32:01 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +6 -18 lines
indent: remove support for form feed characters inside a line

Form feeds are occasionally used to split code into pages, and this use
is still supported.  Having a form feed in the middle of a line is
exotic.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Tue May 16 08:04:03 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +19 -8 lines
indent: fix handling of INDENT OFF/ON comments

Previously, the 'INDENT OFF' comments were interpreted when the newline
token from the line above the comment was processed, which was earlier
than could be reasonably expected.

The 'INDENT ON' comments were interpreted equally early, which led to
the situation that the 'INDENT OFF' comments were preserved literally
but the 'INDENT ON' comments weren't.

Revision 1.172: download - view: text, markup, annotated - select for diffs
Tue May 16 07:13:05 2023 UTC (18 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +3 -53 lines
indent: move parsing of 'INDENT OFF/ON' comments to the lexer

No functional change.

Revision 1.171: download - view: text, markup, annotated - select for diffs
Mon May 15 22:35:41 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +4 -4 lines
indent: fix cast detection

In process_lparen_or_lbracket, ps.paren[...].maybe_cast was not
initialized, which may have been the cause for seemingly random spacing
around binary operators.

While here, clean up the code by reducing the number of accesses to the
parser state.

Revision 1.170: download - view: text, markup, annotated - select for diffs
Mon May 15 13:37:16 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +3 -3 lines
indent: indent multi-line conditions

No functional change.

Revision 1.169: download - view: text, markup, annotated - select for diffs
Mon May 15 13:33:19 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +5 -3 lines
indent: fix indentation of statements after controlling expression

Revision 1.168: download - view: text, markup, annotated - select for diffs
Mon May 15 12:59:43 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +5 -2 lines
indent: fix indentation of expressions in -nlp -eei mode

Revision 1.167: download - view: text, markup, annotated - select for diffs
Mon May 15 08:11:27 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +2 -3 lines
indent: remove redundant include lines

Revision 1.166: download - view: text, markup, annotated - select for diffs
Mon May 15 07:28:45 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +38 -65 lines
indent: clean up memory and buffer management

Remove the need to explicitly initialize the buffers.  To avoid
subtracting null pointers or comparing them using '<', migrate the
buffers from the (start, end) form to the (start, len) form.  This form
also avoids inconsistencies in whether 'buf.e == buf.s' or 'buf.s ==
buf.e' is used.

Make buffer.st const, to avoid accidental modification of the buffer's
content.

Replace '*buf.e++ = ch' with buf_add_char, to avoid having to keep track
how much unwritten space is left in the buffer.  Remove all safety
margins, that is, no more unchecked access to buf.st[-1] or appending
using '*buf.e++'.

Fix line number counting in lex_word for words that contain line breaks.

No functional change.

Revision 1.165: download - view: text, markup, annotated - select for diffs
Sun May 14 22:26:37 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +5 -6 lines
indent: only null-terminate the buffers if necessary

The only case where a buffer is used as a C-style string is when looking
up a keyword.

No functional change.

Revision 1.164: download - view: text, markup, annotated - select for diffs
Sun May 14 14:14:07 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +2 -8 lines
indent: reduce code for scanning tokens

The input line is guaranteed to end with '\n', so there's no need to
carry another pointer around.

No functional change.

Revision 1.163: download - view: text, markup, annotated - select for diffs
Sun May 14 12:12:02 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +2 -10 lines
indent: remove foreign RCS IDs

Revision 1.162: download - view: text, markup, annotated - select for diffs
Sun May 14 11:29:23 2023 UTC (18 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +9 -10 lines
indent: miscellaneous cleanups

Revision 1.161: download - view: text, markup, annotated - select for diffs
Sat May 13 17:20:41 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +4 -2 lines
indent: do not add a blank at the beginning of a line

Most calls to output_line did already reset the variable.  There may be
some untested edge cases in or after comments, but these should be fine
as well.

Revision 1.160: download - view: text, markup, annotated - select for diffs
Sat May 13 15:34:22 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +14 -5 lines
indent: implement 'blank after declarations'

Revision 1.159: download - view: text, markup, annotated - select for diffs
Sat May 13 14:30:48 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +4 -4 lines
indent: use enum instead of magic numbers for tracking declarations

No functional change.

Revision 1.158: download - view: text, markup, annotated - select for diffs
Sat May 13 13:48:54 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +3 -4 lines
indent: improve names of option variables

No functional change.

Revision 1.157: download - view: text, markup, annotated - select for diffs
Sat May 13 12:31:02 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +19 -20 lines
indent: rename struct fields for buffers

No binary change except for assertion line numbers.

Revision 1.156: download - view: text, markup, annotated - select for diffs
Sat May 13 09:27:49 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +8 -2 lines
indent: move debugging code to separate file

No functional change.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Fri May 12 10:53:33 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +2 -8 lines
indent: remove statistics

The numbers from the statistics were wrong.

Revision 1.154: download - view: text, markup, annotated - select for diffs
Thu May 11 19:14:54 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +33 -35 lines
indent: clean up input buffer handling

No functional change.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Thu May 11 19:01:35 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +6 -147 lines
indent: don't touch comments in preprocessing lines

The indentation of multi-line comments was wrong, and the code for
handling them was too complicated.

Revision 1.152: download - view: text, markup, annotated - select for diffs
Thu May 11 18:44:14 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +2 -6 lines
tests/indent: add more tests for preprocessing directives

Revision 1.151: download - view: text, markup, annotated - select for diffs
Thu May 11 18:26:56 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +2 -85 lines
indent: remove unused code

Revision 1.150: download - view: text, markup, annotated - select for diffs
Thu May 11 18:13:55 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +4 -50 lines
indent: remove broken code for handling blank lines

This fixes several bugs where blank lines were erroneously added or
removed, treating these old bugs for new bugs in different places.
These new bugs are expected to be easier to fix, as the old bugs will
not interfere anymore.

Revision 1.149: download - view: text, markup, annotated - select for diffs
Thu May 11 17:22:56 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +10 -2 lines
indent: add debug output for tracking comments and braces

Revision 1.148: download - view: text, markup, annotated - select for diffs
Sat Apr 23 06:43:22 2022 UTC (2 years, 7 months ago) by rillig
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +19 -20 lines
indent: group global variables related to output control

No functional change.

Revision 1.147: download - view: text, markup, annotated - select for diffs
Sun Feb 13 12:48:12 2022 UTC (2 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +4 -4 lines
indent: consistently use nparen for indexing parser_state.paren

No binary change.

Revision 1.146: download - view: text, markup, annotated - select for diffs
Sun Feb 13 12:43:26 2022 UTC (2 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +8 -8 lines
indent: rename parser_state.p_l_follow and paren_level

The previous variable names were misleading.

Paren_level is not the current level of parentheses but the one from the
beginning of the current output line.  For better accuracy, rename it to
line_start_paren_level.

P_l_follow is not the level of parentheses that will be active at some
point in the future, as the previous name suggested.  Instead, it is the
level of parentheses right now.  For better accuracy, rename it to
nparen.  This nicely matches its main usage, which is as index to the
parser_state.paren array.

No binary change.

Revision 1.145: download - view: text, markup, annotated - select for diffs
Sun Feb 13 12:20:09 2022 UTC (2 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +7 -7 lines
indent: replace bitmasking code with struct

The struct directly represents the properties of a pair of parentheses,
without forcing the human reader to decode any bitset.  This makes it
easier to find the remaining bugs in the heuristic for determining the
kind of parentheses.

No functional change outside debug mode.

Revision 1.144: download - view: text, markup, annotated - select for diffs
Sat Feb 12 19:56:52 2022 UTC (2 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +3 -3 lines
indent: fix indentation of enum constants in typedef (since 2019-04-04)

The solution is not elegant since it adds a small state machine inside
the parser state, but at least these states only depend on the sequence
of token types and not on any other part of the parser state.

Reported in PR#55453.

Revision 1.143: download - view: text, markup, annotated - select for diffs
Sun Nov 28 11:49:10 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +53 -16 lines
indent: clean up and document input handling

The transformation of moving comments from after an 'if (expr)' after
the following brace has a large implementation cost (about 300 lines of
code) and makes input handling quite complicated. Document the overall
idea to save future readers some time.

No functional change.

Revision 1.142: download - view: text, markup, annotated - select for diffs
Sat Nov 27 21:15:58 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +9 -10 lines
indent: accept a few formatting suggestions from indent

The remaining issues are still that the conditions look ambiguous even
with -eei, and that __attribute__ is broken into a separate line.

No functional change.

Revision 1.141: download - view: text, markup, annotated - select for diffs
Sat Nov 27 18:37:17 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +14 -14 lines
indent: rename dump functions to output

No functional change.

Revision 1.140: download - view: text, markup, annotated - select for diffs
Sat Nov 27 18:26:48 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +6 -2 lines
indent: add assertions for input handling

Just to document the invariants; the code is already OK.

Revision 1.139: download - view: text, markup, annotated - select for diffs
Fri Nov 26 15:21:38 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +23 -12 lines
indent: enhance debug logging for input handling

Revision 1.138: download - view: text, markup, annotated - select for diffs
Fri Nov 26 15:08:48 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +21 -22 lines
indent: replace inp_enlarge with inp_add

Previously, inbuf.inp.s was only updated at the very end of reading a
line from the input file, which meant that during debugging, it pointed
to invalid memory. Updating all fields in inbuf.inp after every
reallocation makes the code less tricky to understand.

No functional change.

Revision 1.137: download - view: text, markup, annotated - select for diffs
Fri Nov 26 14:48:03 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +43 -45 lines
indent: split inp_read_line into smaller functions

No functional change.

Revision 1.136: download - view: text, markup, annotated - select for diffs
Fri Nov 26 14:33:12 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +21 -11 lines
indent: extract inp_from_file from inp_read_line

No functional change.

Revision 1.135: download - view: text, markup, annotated - select for diffs
Fri Nov 26 14:27:19 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +3 -27 lines
indent: remove code that fixes malformed preprocessor directives

Revision 1.134: download - view: text, markup, annotated - select for diffs
Fri Nov 26 14:17:01 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +2 -18 lines
indent: move ind_add from io.c to indent.c

It's a general-purpose function that is not directly related to input or
output.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Thu Nov 25 21:59:40 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +3 -8 lines
indent: prevent undefined behavior in inp_line_start

No functional change.

Revision 1.132: download - view: text, markup, annotated - select for diffs
Thu Nov 25 20:00:31 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +6 -6 lines
indent: update cross-reference comments for bug in comment handling

The function was renamed in io.c 1.122 from 2021-11-19.

Revision 1.131: download - view: text, markup, annotated - select for diffs
Thu Nov 25 07:45:32 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +3 -3 lines
indent: rename ps.in_stmt to in_stmt_or_decl

The previous name didn't match reality.

No functional change.

Revision 1.130: download - view: text, markup, annotated - select for diffs
Thu Nov 25 07:41:13 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +5 -7 lines
indent: rename ps.ind_stmt to in_stmt_cont

This makes a comment redundant.

No functional change.

Revision 1.129: download - view: text, markup, annotated - select for diffs
Fri Nov 19 20:23:17 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +3 -4 lines
indent: reduce casts to unsigned char for character classification

No functional change.

Revision 1.128: download - view: text, markup, annotated - select for diffs
Fri Nov 19 20:13:05 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +5 -6 lines
indent: keep inbuf.save_com_s and inbuf.save_com_e in sync

No functional change.

Revision 1.127: download - view: text, markup, annotated - select for diffs
Fri Nov 19 20:04:02 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +2 -3 lines
indent: fix included headers

Revision 1.126: download - view: text, markup, annotated - select for diffs
Fri Nov 19 20:01:37 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +9 -8 lines
indent: clean up io.c

No functional change.

Revision 1.125: download - view: text, markup, annotated - select for diffs
Fri Nov 19 19:55:15 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +3 -3 lines
indent: replace ps.procname with ps.is_function_definition

Omly the first character of ps.procname was ever read, and it was only
compared to '\0'.  Using a bool for this means simpler code, less
memory and fewer wasted CPU cycles due to the removed strncpy.

No functional change.

Revision 1.124: download - view: text, markup, annotated - select for diffs
Fri Nov 19 18:25:50 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +15 -3 lines
indent: unexport inbuf

No functional change.

Revision 1.123: download - view: text, markup, annotated - select for diffs
Fri Nov 19 18:23:59 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +17 -2 lines
indent: use character input API from pr_comment.c

No functional change.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Fri Nov 19 18:14:18 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +52 -2 lines
indent: remove all references to inbuf from indent.c

No functional change.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Fri Nov 19 17:59:16 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +58 -2 lines
indent: move character input handling from indent.c to io.c

No functional change.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Fri Nov 19 17:42:45 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +65 -2 lines
indent: move character input from indent.c to io.c

No functional change.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Fri Nov 19 17:30:10 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +14 -2 lines
indent: use character input API from the tokenizer

No functional change.

Revision 1.118: download - view: text, markup, annotated - select for diffs
Fri Nov 19 17:20:57 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +32 -2 lines
indent: move character input handling from lexi.c to io.c

No functional change.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Fri Nov 19 15:28:32 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +19 -19 lines
indent: group variables for input handling

No functional change.

Revision 1.116: download - view: text, markup, annotated - select for diffs
Sun Nov 7 07:06:00 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +3 -3 lines
indent: rename 'inbuf' functions to 'inp'

The variable 'inp' used to be named 'inbuf'. Make the function names
correspond to the variable name again.

No functional change.

Revision 1.115: download - view: text, markup, annotated - select for diffs
Fri Nov 5 21:39:12 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +3 -4 lines
indent: the '+ 1' in dump_line_code is not an off-by-one error

Revision 1.114: download - view: text, markup, annotated - select for diffs
Thu Nov 4 19:23:57 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +4 -8 lines
indent: do not discard former error comments anymore

Since io.c 1.20 from 2019-10-19, indent has not placed error comments in
the code anymore. Since these comments are supposed to be cleaned up
immediately, there is no point in having code for handling them.

Revision 1.113: download - view: text, markup, annotated - select for diffs
Thu Nov 4 17:10:37 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +21 -16 lines
indent: extract compute_code_indent_lineup into separate function

Having 9 different paths in a single function made it more complicated
to understand than necessary.

No functional change.

Revision 1.112: download - view: text, markup, annotated - select for diffs
Thu Nov 4 17:08:50 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +6 -12 lines
indent: fix off-by-one confusion in paren_indent

The variable was called 'indent' but actually contained a 'column',
which was off by one.

No functional change.

Revision 1.111: download - view: text, markup, annotated - select for diffs
Thu Nov 4 17:07:02 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +12 -12 lines
indent: replace column computation with indentation computation

No functional change.

Revision 1.110: download - view: text, markup, annotated - select for diffs
Thu Nov 4 00:13:57 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +28 -25 lines
indent: group conditions in compute_code_indent by topic

No functional change.

Revision 1.109: download - view: text, markup, annotated - select for diffs
Wed Nov 3 21:47:35 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +10 -16 lines
indent: inline indentation_after, shorten function name to ind_add

There were only few calls to indentation_after, so inlining it spares
the need to look at yet another function definition. Another effect is
that code.s and code.e appear in the code as a pair now, instead of a
single code.s, making the scope of the function call obvious.

In ind_add, there is no need to check for '\0' anymore since none of the
buffers can ever contain a null character, these are filtered out by
inbuf_read_line.

No functional change.

Revision 1.108: download - view: text, markup, annotated - select for diffs
Sat Oct 30 11:49:38 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +3 -3 lines
indent: inline macro label_offset

No functional change.

Revision 1.107: download - view: text, markup, annotated - select for diffs
Fri Oct 29 20:27:42 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +10 -10 lines
indent: merge isblank and is_hspace into ch_isblank

No functional change.

Revision 1.106: download - view: text, markup, annotated - select for diffs
Fri Oct 29 19:12:48 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +4 -4 lines
indent: fix undefined behavior in buffer handling

Adding an arbitrary integer to a pointer may result in an out of bounds
pointer, so replace the addition with a pointer subtraction.

In the buffer handling functions, handle 'buf' and 'l' before 's' and
'e', since they are pairs.

In inbuf_read_line, use 's' instead of 'buf' to make the code easier to
understand for human readers.

No functional change.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Fri Oct 29 18:18:03 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +6 -6 lines
indent: reorder global variables to be more intuitive

The buffer 'inp' comes first. From there, a single token is read into
the buffer 'token'. From there, it usually ends up in 'code'. The buffer
'token' does not belong to the group of the other 3 buffers, which
together make up a line of formatted output.

No functional change.

Revision 1.104: download - view: text, markup, annotated - select for diffs
Fri Oct 29 17:32:22 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +3 -3 lines
indent: rename ps.dumped_decl_indent and indent_declaration

The word 'dump' in 'ps.dumped_decl_indent' was too close to dump_line,
which led to confusion since the variable controls whether the
indentation has been added to the code buffer, which happens way before
actually dumping the current line to the output file.

The function name 'indent_declaration' was too unspecific, it did not
reveal where the indentation of the declaration actually happened.

No functional change.

Revision 1.103: download - view: text, markup, annotated - select for diffs
Wed Oct 27 00:04:51 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +3 -6 lines
indent: fix indentation of local variable declarations

This had been broken since the import of FreeBSD indent in 2019.

Revision 1.102: download - view: text, markup, annotated - select for diffs
Sun Oct 24 17:19:48 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +2 -25 lines
indent: clean up format of warnings and errors

Previously, warnings and errors had the form of C block comments. Before
NetBSD io.c 1.20 from 2019-10-19, this format made sense because the
diagnostics could end up in the same output stream as the formatted
output.

Since NetBSD io.c 1.20 from 2019-10-19, all diagnostics are redirected
to stderr. This change was not mentioned in the commit message back
then, it makes sense nevertheless. Since stdout and stderr now are
properly separated, there is no need anymore to keep the weird format
for warnings and errors. Switch to the standard 'error: file:line'
format.

Move the function 'diag' to indent.c to have access to the name of the
current input file.

Revision 1.101: download - view: text, markup, annotated - select for diffs
Sun Oct 24 11:17:05 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +17 -9 lines
indent: replace global variable use_ff with function parameter

Revision 1.100: download - view: text, markup, annotated - select for diffs
Sun Oct 24 10:54:12 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +3 -3 lines
indent: sort includes

Revision 1.99: download - view: text, markup, annotated - select for diffs
Wed Oct 20 05:14:21 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +8 -8 lines
indent: rename blankline_requested variables

The words 'prefix' and 'postfix' sounded too much like horizontal
concepts, like in operators. The actual purpose of these variables is to
add blank lines before and after the current line, so use the same
wording as in the command line options.

No functional change.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Wed Oct 20 05:00:37 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +9 -9 lines
indent: rename next_blank_lines to blank_lines_to_output

The previous name was already an improvement over the name before that
(n_real_blanklines), but didn't express the intended purpose clearly
enough, so try another name.

No functional change.

Revision 1.97: download - view: text, markup, annotated - select for diffs
Tue Oct 19 21:39:19 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +3 -4 lines
indent: always keep next_blank_lines >= 0

No functional change.

Revision 1.96: download - view: text, markup, annotated - select for diffs
Tue Oct 19 21:21:07 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +4 -6 lines
indent: use simpler code for copying the input buffer

In debug mode, this reduces the amount of debug output lines.

No functional change in default mode.

Revision 1.95: download - view: text, markup, annotated - select for diffs
Tue Oct 19 18:29:59 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +7 -7 lines
indent: if a file ends with indent off, don't add space-newline

Revision 1.94: download - view: text, markup, annotated - select for diffs
Mon Oct 11 19:04:47 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +7 -7 lines
indent: use bool for suppress_blanklines

It only ever got assigned the values 0 and 1.

No functional change.

Revision 1.93: download - view: text, markup, annotated - select for diffs
Mon Oct 11 18:55:49 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +2 -12 lines
indent: remove dead code

Revision 1.92: download - view: text, markup, annotated - select for diffs
Sat Oct 9 11:13:25 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +14 -13 lines
indent: condense code for calculating indentations

No functional change.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Sat Oct 9 11:00:27 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +4 -4 lines
indent: extract common code for advancing a single tab

No functional change.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Fri Oct 8 21:16:23 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +10 -10 lines
indent: improve local variable names

No functional change.

Revision 1.89: download - view: text, markup, annotated - select for diffs
Fri Oct 8 21:13:58 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +6 -9 lines
indent: rename fill_buffer to inbuf_read_line

No functional change.

Revision 1.88: download - view: text, markup, annotated - select for diffs
Fri Oct 8 19:03:34 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +3 -3 lines
indent: run indent on indent.h

The formatting looks mostly OK.

Some struct members had excessively long names, leaving no space for
their corresponding comments. Renamed some of them using well-known
abbreviations.

The formatting for debug_vis_range is messed up, no idea why. It is
clearly a function declaration, not a function definition, so there is
no need to place the function name in column 1.

No functional change.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Fri Oct 8 18:29:36 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +2 -7 lines
indent: fix formatting of C99 comments

The first attempt at formatting C99 comments was conceptually wrong. It
accessed the next token in dump_line, even though that function should
only ever look at the buffers for the label, the code and the current
comment. (Understanding that part of the code was difficult at that time
due to the sheer number of global variables.) The complicated and
ever-growing condition for whether to output the token was a hack and in
retrospect doesn't make sense at all, that's why it only came close to
the intended effect.

Some unintended side effects were that the C99 comments had an
additional space in front of them, and that in some cases an empty line
followed the comment, and that the comments were not aligned.

Previously, the newline that terminates the C99 comment was included in
the comment. Separating the newline from the comment fixed all these
unintended side effects. The only downside is that the multi-line
statement is not indented, but that should be easy to fix.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Fri Oct 8 17:56:12 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +121 -101 lines
indent: split dump_line into smaller functions

No functional change.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Fri Oct 8 17:19:49 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +3 -3 lines
indent: replace column calculations with indent, part 4/4

Revision 1.84: download - view: text, markup, annotated - select for diffs
Fri Oct 8 17:12:08 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +7 -10 lines
indent: replace column calculations with indent, part 3

No functional change.

Revision 1.83: download - view: text, markup, annotated - select for diffs
Fri Oct 8 17:07:36 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +11 -11 lines
indent: replace column calculations with indent, part 2

No functional change.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Fri Oct 8 17:04:13 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +11 -11 lines
indent: calculate indentation instead of column

This avoids constantly adding and subtracting 1.

No functional change.

Revision 1.81: download - view: text, markup, annotated - select for diffs
Fri Oct 8 17:00:21 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +15 -18 lines
indent: reduce indentation in dump_line

Revision 1.80: download - view: text, markup, annotated - select for diffs
Thu Oct 7 23:18:47 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +7 -7 lines
indent: rename bp_save to saved_inp_s, be_save to saved_inp_e

Using the same naming convention makes it easier to relate the
variables.

No functional change.

Revision 1.79: download - view: text, markup, annotated - select for diffs
Thu Oct 7 23:15:15 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +19 -19 lines
indent: group variables for the input buffer

The input buffer follows the same concept as the intermediate buffers
for label, code, comment and token, so use the same type for it.

No functional change.

Revision 1.78: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:57:21 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +5 -5 lines
indent: use braces around multi-line statements

No functional change.

Revision 1.77: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:52:54 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +30 -3 lines
indent: let the code breathe a bit by inserting empty lines

No functional change.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Thu Oct 7 21:38:25 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +4 -10 lines
indent: remove redundant comments

No functional change.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Thu Oct 7 19:35:50 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +4 -4 lines
indent: clean up colon handling

No functional change.

Revision 1.74: download - view: text, markup, annotated - select for diffs
Thu Oct 7 18:32:09 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +6 -6 lines
indent: raise WARNS from the default 5 up to 6

Revision 1.73: download - view: text, markup, annotated - select for diffs
Tue Oct 5 21:05:12 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +24 -25 lines
indent: rewrite parse_indent_comment for human readers

The generated code is still very similar, GCC does a good job at
inlining strncmp.

No functional change.

Revision 1.72: download - view: text, markup, annotated - select for diffs
Tue Oct 5 18:50:42 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +10 -10 lines
indent: rename n_real_blanklines

The word 'n' was not as helpful as possible, the word 'real' did not
give any clue at all about the variable's purpose.

No functional change.

Revision 1.71: download - view: text, markup, annotated - select for diffs
Tue Oct 5 06:24:06 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +7 -7 lines
indent: rename local char variable, reduce scope of counters

No functional change.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Tue Oct 5 06:15:24 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +3 -3 lines
indent: use proper escape sequence for form feed

This escape sequence has been available since at least 1978.

Revision 1.69: download - view: text, markup, annotated - select for diffs
Tue Oct 5 06:09:42 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +5 -5 lines
indent: merge duplicate code into is_hspace

No functional change.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Sun Sep 26 21:23:31 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +3 -2 lines
indent: unexport global variables

The variable match_state was write-only and was thus removed.

No functional change.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Sun Sep 26 19:37:11 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +29 -25 lines
indent: let indent format its own code -- in supervised mode

After running indent on the code, I manually selected each change that
now looks better than before. The remaining changes are left for later.
All in all, indent did a pretty good job, except for syntactic additions
from after 1990, but that was to be expected. Examples for such
additions are GCC's __attribute__ and C99 designated initializers.

Indent has only few knobs to tune the indentation. The knob for the
continuation indentation applies to function declarations as well as to
expressions. The knob for indentation of local variable declarations
applies to struct members as well, even if these are members of a
top-level struct.

Several code comments crossed the right margin in column 78. Several
other code comments were correctly broken though. The cause for this
difference was not obvious.

No functional change.

Revision 1.66: download - view: text, markup, annotated - select for diffs
Sat Sep 25 22:57:04 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +3 -5 lines
indent: misc cleanup

No functional change.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Sat Sep 25 22:54:32 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +3 -3 lines
indent: convert found_err to bool

That variable had slipped through the migration since it consequently
used int for the declaration, the definition and all assignments.

No functional change.

Revision 1.64: download - view: text, markup, annotated - select for diffs
Sat Sep 25 20:56:53 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +3 -3 lines
indent: un-abbreviate a few parser_state members, clean up comments

No functional change.

Revision 1.63: download - view: text, markup, annotated - select for diffs
Sat Sep 25 20:23:42 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +3 -6 lines
indent: remove dead code for printing comments after empty lines

This code has been commented out for at least 29 years.

No functional change.

Revision 1.62: download - view: text, markup, annotated - select for diffs
Sat Sep 25 17:36:51 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +5 -9 lines
indent: convert remaining ibool to bool

No functional change intended.

Revision 1.61: download - view: text, markup, annotated - select for diffs
Sat Sep 25 17:29:13 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +2 -8 lines
indent: convert parser_state from ibool to bool

indent.c:400:5: error: suggest parentheses around assignment used as
    truth value
io.c:271:32: error: ‘~’ on a boolean expression

No functional change intended.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Sat Sep 25 17:11:23 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +26 -16 lines
indent: prepare for lint's strict bool mode

Before C99, C had no boolean type. Instead, indent used int for that,
just like many other programs. Even with C99, bool and int can be used
interchangeably in many situations, such as querying '!i' or '!ptr' or
'cond == 0'.

Since January 2021, lint provides the strict bool mode, which makes bool
a non-arithmetic type that is incompatible with any other type. Having
clearly separate types helps in understanding the code.

To migrate indent to strict bool mode, the first step is to apply all
changes that keep the resulting binary the same. Since sizeof(bool) is
1 and sizeof(int) is 4, the type ibool serves as an intermediate type.
For now it is defined to int, later it will become bool.

The current code compiles cleanly in C99 and C11 mode, as well as in
lint's strict bool mode. There are a few tricky places:

In args.c in 'struct pro', there are two types of options: boolean and
integer. Boolean options point to a bool variable, integer options
point to an int variable. To keep the current structure of the code,
the pointer has been changed to 'void *'. To ensure type safety, the
definition of the options is done via preprocessor magic, which in C11
mode ensures the correct pointer types. (Add CFLAGS+=-std=gnu11 at the
very bottom of the Makefile.)

In indent.c in process_preprocessing, a boolean variable is
post-incremented. That variable is only assigned to another variable,
and that variable is only used in a boolean context. To provoke a
different behavior between the '++' and the '= true', the source code
to be indented would need 1 << 32 preprocessing directives, which is
unlikely to happen in practice.

In io.c in dump_line, the variables ps.in_stmt and ps.in_decl only ever
get the values 0 and 1. For these values, the expressions 'a & ~b' and
'a && !b' are equivalent, in all versions of C. The compiler may
generate different code for them, though.

In io.c in parse_indent_comment, the assignment to inhibit_formatting
takes place in integer context. If the compiler is smart enough to
detect the possible values of on_off, it may generate the same code
before and after the change, but that is rather unlikely.

The second step of the migration will be to replace ibool with bool,
step by step, just in case there are any hidden gotchas in the code,
such as sizeof or pointer casts.

No change to the resulting binary.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Sat Sep 25 13:38:32 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +2 -6 lines
indent: remove ifdef for lint

NetBSD lint does not need them anymore, FreeBSD does not have lint.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Sat Sep 25 10:41:03 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +6 -6 lines
indent: move statistical values into a separate struct

No functional change.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Sat Sep 25 08:23:31 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +3 -5 lines
indent: add nonnull memory allocation functions

The only functional change is a single error message.

Revision 1.56: download - view: text, markup, annotated - select for diffs
Sat Sep 25 08:04:13 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +4 -4 lines
indent: group global variables for token buffer

No functional change.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Sat Sep 25 07:55:24 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +11 -11 lines
indent: group global variables for code buffer

No functional change.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Fri Sep 24 18:47:29 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +22 -22 lines
indent: group global variables for label buffer into struct

No functional change.

Revision 1.53: download - view: text, markup, annotated - select for diffs
Fri Sep 24 18:37:03 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +59 -40 lines
indent: extract parse_indent_comment from fill_buffer

No functional change.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Fri Sep 24 18:14:06 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +11 -11 lines
indent: group global variables for the comment buffer

No functional change.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Fri Sep 24 18:00:13 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +8 -8 lines
indent: rename local variable in fill_buffer

The local variable name 'com' prevented grouping the global variables
combuf, s_com, e_com and l_com into a struct named 'com'.

No functional change.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Fri Sep 24 16:29:31 2021 UTC (3 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +4 -3 lines
indent: fix token duplication after C99 comment

The code that keeps blank lines after C99 comments still looks wrong,
but at least it's better than before.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Sun Mar 14 01:44:37 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
CVS tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +6 -4 lines
indent: make compute_code_indent more readable

The '?:' operator computing the factor was too hard to read.  When
quickly scanning the code, the 1 in the expression looked too much like
it would be added to the indentation, which would turn the indentation
length into a column number, and that again would smell like an
off-by-one error.

No functional change.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Sun Mar 14 00:22:16 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +4 -4 lines
indent: fix lint warnings

No functional change.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Sat Mar 13 18:46:39 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +3 -2 lines
indent: add debug logging for switching the input buffer

No functional change outside debug mode.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Sat Mar 13 18:24:56 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +10 -12 lines
indent: align comments in indent's own code

No functional change.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Sat Mar 13 13:55:42 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +11 -11 lines
indent: rename local variable in dump_line

This clarifies that the variable names a column, not an indentation.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Sat Mar 13 13:54:01 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +4 -4 lines
indent: in dump_line, reduce scope of local variable

This allows the variable 'target' in the lower half of the function to
get a more specific name.

No functional change.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Sat Mar 13 13:51:08 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +6 -6 lines
indent: distinguish between 'column' and 'indentation'

column == 1 + indentation.

In addition, indentation is a relative distance while column is an
absolute position.  Therefore, don't confuse these two concepts, to
prevent off-by-one errors.

No functional change.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Sat Mar 13 11:19:43 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +4 -4 lines
indent: fix confusing variable names

The word 'col' should only be used for the 1-based column number.  This
name is completely inappropriate for a line length since that provokes
off-by-one errors.  The name 'cols' would be acceptable although
confusing since it sounds so similar to 'col'.

Therefore, rename variables that are related to the maximum line length
to 'line_length' since that makes for obvious code and nicely relates to
the description of the option in the manual page.

No functional change.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sat Mar 13 10:32:25 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +6 -18 lines
indent: inline calls to count_spaces and count_spaces_until

These two functions operated on column numbers instead of indentation,
which required adjustments of '+ 1' and '- 1'.  Their names were
completely wrong since these functions did not count anything, instead
they computed the column.

No functional change.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Sat Mar 13 10:20:54 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +26 -30 lines
indent: replace column computation with indentation computation

No functional change.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Sat Mar 13 10:06:47 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +19 -14 lines
indent: replace compute_code_column with compute_code_indent

The goal is to only ever be concerned about the _indentation_ of a
token, never the _column_ it appears in.  Having only one of these
avoids off-by-one errors.

No functional change.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Sat Mar 13 09:54:11 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +9 -8 lines
indent: replace compute_label_column with compute_label_indent

Using the invariant 'column == 1 + indent'.  This removes several overly
complicated '+ 1' from the code that are not needed conceptually.

No functional change.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Sat Mar 13 09:48:04 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +8 -8 lines
indent: manually fix indentation in indent's own source code

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sat Mar 13 09:21:57 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +24 -8 lines
indent: add debug logging for actually writing to the output file

Together with the results of the tokenizer and the 4 buffers for token,
label, code and comment, the debug log now provides a good high-level
view on how the indentation happens and where to look for the many
remaining bugs.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Sat Mar 13 09:06:12 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +3 -15 lines
indent: remove strange debugging code that went in the output file

Whenever the code to be output contained the magic byte 0x80, instead of
writing this byte, indent wrote the column number at the beginning of
the code snippet, times 7.  Especially the 'times 7' does not make any
sense at all.

In ISO-8859-1, this character position is not assigned.  In Microsoft
Codepage 1252 it is the Euro sign.  In UTF-8 (which was probably not on
the author's list when the code was originally written) it occurs as the
middle byte for code points like U+2026 (horizontal ellipsis) from the
block General Punctuation.

Remove this strange code, thereby fixing indent for UTF-8 code.  The
code had been there since at least 1993-04-09, when it was first
imported to NetBSD.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Sat Mar 13 00:26:56 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +30 -44 lines
indent: replace pad_output with output_indent

Calculating the indentation is simpler than calculating the column,
since that saves the constant addition and subtraction of the 1.

No functional change.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Sat Mar 13 00:03:29 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +4 -51 lines
indent: clean up verbose documentation comments from the 1970s

Since C90, there is no need to repeat the type of the function
parameters.

In the whole code of indent, there is a lot of confusion between the
concepts of a 'column' (which is a position on the screen, counting
starts at 1) and 'indentation' (which is a length, not a position).  To
avoid this confusion, the code will be rewritten anyway very soon.

Repeatedly adding and subtracting 1 from the 'current column' is not
elegant, this should rather be done by consistently measuring only the
indentation from the left border (at offset 0), as a distance, not as an
absolute position.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Fri Mar 12 23:27:41 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +12 -14 lines
indent: add 'const', rename variables, reorder formula for tab width

Column counting starts at 1.  This 1 should rather be at the beginning
of the formula since it is thought of being added at the very beginning
of the line, not at the end.

When adding a tab, the newly added tab is added at the end of the
string, therefore that '+ 1' should be at the end of the formula as
well.

No functional change.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Fri Mar 12 23:16:00 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +10 -10 lines
indent: replace 'target' with 'indent' in function names

The word 'target' was not as specific as possible.

No functional change.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Fri Mar 12 23:10:18 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +11 -16 lines
indent: use consistent indentation for 'else'

Half of the code used -ce, the other half the opposite -nce.

No functional change.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Fri Mar 12 19:14:18 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +3 -3 lines
indent: make output_string inline

GCC 9.3.0 didn't notice that the argument to this function is always a
string literal, which makes it worthwhile to inline the call.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Fri Mar 12 19:11:29 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +52 -21 lines
indent: add helper functions for doing the actual output

This allows to add debug logging to these few functions instead of all
other places that might output something.

Reducing the possible output formats to a few primitives makes dump_line
simpler, especially the fprintf calls.  It also removes the non-constant
printf string.

The call to output_int may be meant for debugging, as the character 0x80
is unlikely to appear in any real-world code.

No functional change.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Mon Mar 8 22:28:31 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +3 -4 lines
indent: remove redundant initializer in dump_line

No functional change.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Mon Mar 8 22:26:17 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +8 -7 lines
indent: move comment about dump_line to column 1

It looked misplaced on the right side since that area is usually
reserved for small remarks, not long explanations.

No functional change.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Mon Mar 8 22:23:58 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +7 -6 lines
indent: always use braces in do-while loops

Having a 'while' at the beginning of a line looks as if it would start a
loop.  It's confusing when it _ends_ a loop instead.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Sun Mar 7 22:11:01 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +7 -2 lines
indent: fix handling of '//' end-of-line comments

Revision 1.23: download - view: text, markup, annotated - select for diffs
Sun Mar 7 20:47:13 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +6 -6 lines
indent: remove redundant parentheses around return value

No functional change.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Sun Mar 7 10:42:48 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +3 -3 lines
indent: use all headers in all files

This is a prerequisite for converting the token types to an enum instead
of a preprocessor define, since the return type of lexi will become
token_type.  Having the enum will make debugging easier.

There was a single naming collision, which forced the variable in
scan_profile to be renamed.  All other token names are used nowhere
else.

No change to the resulting binary.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Sat Mar 6 20:30:06 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +5 -5 lines
indent: fix space-tab alignment in indent's own code

These parts are not fixed automatically by indent since they are in box
comments.

No functional change.

Revision 1.17.16.2: download - view: text, markup, annotated - select for diffs
Mon Apr 13 08:05:43 2020 UTC (4 years, 8 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.17.16.1: preferred, colored; branchpoint 1.17: preferred, colored; next MAIN 1.18: preferred, colored
Changes since revision 1.17.16.1: +16 -43 lines
Mostly merge changes from HEAD upto 20200411

Revision 1.20: download - view: text, markup, annotated - select for diffs
Sat Oct 19 15:44:31 2019 UTC (5 years, 1 month ago) by christos
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, is-mlppp-base, is-mlppp
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +16 -43 lines
use stdarg, annotate function as __printflike and fix broken formats.

Revision 1.17.16.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:10:20 2019 UTC (5 years, 6 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +358 -509 lines
Sync with HEAD

Revision 1.1.1.2 (vendor branch): download - view: text, markup, annotated - select for diffs
Thu Apr 4 20:39:17 2019 UTC (5 years, 8 months ago) by kamil
Branches: FREEBSD, CSRG
CVS tags: r340138
Diff to: previous 1.1.1.1: preferred, colored
Changes since revision 1.1.1.1: +175 -272 lines
FreeBSD indent r340138

Revision 1.19: download - view: text, markup, annotated - select for diffs
Thu Apr 4 15:22:13 2019 UTC (5 years, 8 months ago) by kamil
Branches: MAIN
CVS tags: phil-wifi-20190609, netbsd-9-base, netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +358 -510 lines
Upgrade indent(1)

Merge all the changes from the recent FreeBSD HEAD snapshot
into our local copy.

FreeBSD actively maintains this program in their sources and their
repository contains over 100 commits with changes.

Keep the delta between the FreeBSD and NetBSD versions to absolute
minimum, mostly RCS Id and compatiblity fixes.

Major chages in this import:

 - Added an option -ldi<N> to control indentation of local variable names.
 - Added option -P for loading user-provided files as profiles
 - Added -tsn for setting tabsize
 - Rename -nsac/-sac ("space after cast") to -ncs/-cs
 - Added option -fbs Enables (disables) splitting the function declaration and opening brace across two lines.
 - Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)
 - Group global option variables into an options structure
 - Use bsearch() for looking up type keywords.
 - Don't produce unneeded space character in function declarators
 - Don't unnecessarily add a blank before a comment ends.
 - Don't ignore newlines after comments that follow braces.

Merge the FreeBSD intend(1) tests with our ATF framework.
All tests pass.

Upgrade prepared by Manikishan Ghantasala.
Final polishing by myself.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Feb 3 03:19:29 2019 UTC (5 years, 10 months ago) by mrg
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +3 -2 lines
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily

Revision 1.17: download - view: text, markup, annotated - select for diffs
Thu Feb 25 13:23:27 2016 UTC (8 years, 9 months ago) by ginsbach
Branches: MAIN
CVS tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-3-RELEASE, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: phil-wifi
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +5 -5 lines
Fix obvious contraction spelling mistakes by adding missing apostrophes.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Mon Feb 22 19:04:18 2016 UTC (8 years, 9 months ago) by ginsbach
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +3 -4 lines
Use errx(3).

Revision 1.14.24.1: download - view: text, markup, annotated - select for diffs
Sun Sep 21 18:58:56 2014 UTC (10 years, 2 months ago) by snj
Branches: netbsd-7
CVS tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Diff to: previous 1.14: preferred, colored; next MAIN 1.15: preferred, colored
Changes since revision 1.14: +7 -5 lines
Pull up following revision(s) (requested by mrg in ticket #110):
	usr.bin/indent/io.c: revision 1.15
	usr.bin/indent/indent_globs.h: revision 1.10
	usr.bin/indent/args.c: revision 1.11
	usr.bin/indent/indent.1: revision 1.23
	usr.bin/indent/indent.c: revision 1.19
port the -ut / -nut options from freebsd.  -ut (default) enables tabs
in output, the -nut uses spaces.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Thu Sep 4 04:06:07 2014 UTC (10 years, 3 months ago) by mrg
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +7 -5 lines
port the -ut / -nut options from freebsd.  -ut (default) enables tabs
in output, the -nut uses spaces.

Revision 1.13.42.1: download - view: text, markup, annotated - select for diffs
Wed May 13 19:19:52 2009 UTC (15 years, 7 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.13: preferred, colored; next MAIN 1.14: preferred, colored
Changes since revision 1.13: +5 -5 lines
Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.14: download - view: text, markup, annotated - select for diffs
Sun Apr 12 11:09:49 2009 UTC (15 years, 8 months ago) by lukem
Branches: MAIN
CVS tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-premerge-20091211, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, jym-xensuspend-nbase, jym-xensuspend-base, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: netbsd-7
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +5 -5 lines
Fix WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare)

Revision 1.13: download - view: text, markup, annotated - select for diffs
Thu Oct 16 06:51:22 2003 UTC (21 years, 2 months ago) by itojun
Branches: MAIN
CVS tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, mjf-devfs2-base, mjf-devfs2, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, chap-midi-nbase, chap-midi-base, chap-midi, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: jym-xensuspend
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +6 -4 lines
safer use of realloc

Revision 1.12: download - view: text, markup, annotated - select for diffs
Thu Aug 7 11:14:09 2003 UTC (21 years, 4 months ago) by agc
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +29 -2 lines
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun May 26 22:53:38 2002 UTC (22 years, 6 months ago) by wiz
Branches: MAIN
CVS tags: fvdl_fs64_base
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +14 -42 lines
Remove #ifndef'd __STDC__ code. ANSIfy.

Revision 1.9.2.1: download - view: text, markup, annotated - select for diffs
Thu Oct 19 14:48:53 2000 UTC (24 years, 1 month ago) by he
Branches: netbsd-1-4
CVS tags: netbsd-1-4-PATCH003
Diff to: previous 1.9: preferred, colored; next MAIN 1.10: preferred, colored
Changes since revision 1.9: +3 -3 lines
Pull up revision 1.10 (requested by is):
  The type of the difference between pointers is implementation-
  defined (long on sparc and int on most others).  Compensate when
  printing.

Revision 1.9.10.1: download - view: text, markup, annotated - select for diffs
Tue Oct 17 02:16:44 2000 UTC (24 years, 2 months ago) by tv
Branches: netbsd-1-5
CVS tags: netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA
Diff to: previous 1.9: preferred, colored; next MAIN 1.10: preferred, colored
Changes since revision 1.9: +3 -3 lines
Pullup 1.10 [is]:
Due to infinite wisdom by the language designers, the difference of pointers
has a type of (int) on i386 and (long) on sparc, and I don't even want to
know what else on other cpu types.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sat Oct 14 18:07:10 2000 UTC (24 years, 2 months ago) by is
Branches: MAIN
CVS tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +3 -3 lines
Due to infinite wisdom by the language designers, the difference of pointers
has a type of (int) on i386 and (long) on sparc, and I don't even want to
know what else on other cpu types.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sat Dec 19 17:00:08 1998 UTC (25 years, 11 months ago) by christos
Branches: MAIN
CVS tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, netbsd-1-5-base, netbsd-1-5-ALPHA2, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, minoura-xpg4dl-base, minoura-xpg4dl, comdex-fall-1999-base, comdex-fall-1999
Branch point for: netbsd-1-5, netbsd-1-4
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +8 -8 lines
char -> unsigned char, braces for gcc-2.8.1

Revision 1.8: download - view: text, markup, annotated - select for diffs
Tue Aug 25 20:59:37 1998 UTC (26 years, 3 months ago) by ross
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +27 -11 lines
Add { and } to shut up egcs. Reformat the more questionable code.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Mon Mar 30 02:25:33 1998 UTC (26 years, 8 months ago) by mrg
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +3 -3 lines
use static int instead of static

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sun Oct 19 14:06:35 1997 UTC (27 years, 1 month ago) by mrg
Branches: MAIN
CVS tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +3 -3 lines
fix compile warnings on the alpha.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Oct 19 03:17:23 1997 UTC (27 years, 1 month ago) by lukem
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +503 -467 lines
WARNSify, fix .Nm usage, deprecate register, use <err.h>, KNFify (with indent!;)

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sat Oct 18 16:04:45 1997 UTC (27 years, 2 months ago) by mrg
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +9 -5 lines
merge lite-2.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Thu Jan 9 20:20:15 1997 UTC (27 years, 11 months ago) by tls
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +3 -1 lines
RCS ID police

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Aug 1 18:14:32 1993 UTC (31 years, 4 months ago) by mycroft
Branches: MAIN
CVS tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-PATCH001, netbsd-1-2-BETA, netbsd-1-2, netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1, netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +2 -1 lines
Add RCS identifiers.

Revision 1.1.1.1 (vendor branch): download - view: text, markup, annotated - select for diffs
Sun Jun 6 21:52:29 1993 UTC (31 years, 6 months ago) by mrg
Branches: FREEBSD, CSRG
CVS tags: lite-2
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +3 -3 lines
4.4BSD-Lite2

Revision 1.1: download - view: text, markup, annotated - select for diffs
Fri Apr 9 12:59:14 1993 UTC (31 years, 8 months ago) by cgd
Branches: MAIN
CVS tags: netbsd-alpha-1, netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9, netbsd-0-8
added, from net/2 (patch 124).

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>