Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src



Module Name:    src
Committed By:   rillig
Date:           Mon May 15 07:28:45 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_comment.c
        src/usr.bin/indent: debug.c indent.c indent.h io.c lexi.c parse.c
            pr_comment.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.267 -r1.268 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.132 -r1.133 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.165 -r1.166 src/usr.bin/indent/io.c
cvs rdiff -u -r1.184 -r1.185 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/indent/parse.c
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/indent/pr_comment.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index