[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] git-merge-changelog: prefer idx_t
|
From: |
Bruno Haible |
|
Subject: |
Re: [PATCH 3/4] git-merge-changelog: prefer idx_t |
|
Date: |
Mon, 22 May 2023 14:43:06 +0200 |
Thanks for the many improvements, Paul.
Nevertheless, I feel that a few code style changes are in order:
* I don't much like side effects inside parenthesized expressions, if
the side effect and the expression are not semantically related:
if (mapping->index_mapping_reverse[--jj] < 0)
For me, such side effects are only OK e.g. in parsers, where one
writes code like
if (buf[i++] == '\n')
* gl_list.h says that the return value of some functions can be
(size_t)(-1). For consistency with that, write (size_t)(-1) here
as well. The '-1' reminds the reader of the -1 return values of
functions like 'strchr' or 'strrchr'.
* Since in this file, variables starting with 'i' generally are
indices into FILE1 and variables starting with 'j' generally are
indices into FILE2, it's better to rename in2 to jrev.
2023-05-22 Bruno Haible <bruno@clisp.org>
git-merge-changelog: Code style changes.
* lib/git-merge-changelog.c: Don't make side effects to variables
inside parenthesized expressions. Write (size_t)(-1), for consistency
with gl_list.h.
(compute_mapping): Rename variable in2 to jrev.
0001-git-merge-changelog-Code-style-changes.patch
Description: Text Data