* [PATCH 0/2] Trivial cleanups
@ 2021-06-13 6:37 Felipe Contreras
2021-06-13 6:37 ` [PATCH 1/2] config: avoid yoda conditions Felipe Contreras
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Felipe Contreras @ 2021-06-13 6:37 UTC (permalink / raw)
To: git; +Cc: Martin Ågren, Felipe Contreras
These perfeclty good patches from 2014 weren't picked with no good
reason.
[1] https://lore.kernel.org/git/1398808178-3703-1-git-send-email-felipe.contreras@gmail.com/
Felipe Contreras (2):
config: avoid yoda conditions
add: avoid yoda condition
builtin/add.c | 2 +-
config.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.32.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] config: avoid yoda conditions
2021-06-13 6:37 [PATCH 0/2] Trivial cleanups Felipe Contreras
@ 2021-06-13 6:37 ` Felipe Contreras
2021-06-13 6:37 ` [PATCH 2/2] add: avoid yoda condition Felipe Contreras
2021-06-15 1:45 ` [PATCH 0/2] Trivial cleanups Junio C Hamano
2 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2021-06-13 6:37 UTC (permalink / raw)
To: git; +Cc: Martin Ågren, Felipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config.c b/config.c
index f9c400ad30..7094530b04 100644
--- a/config.c
+++ b/config.c
@@ -1232,7 +1232,7 @@ static int git_parse_maybe_bool_text(const char *value)
int git_parse_maybe_bool(const char *value)
{
int v = git_parse_maybe_bool_text(value);
- if (0 <= v)
+ if (v >= 0)
return v;
if (git_parse_int(value, &v))
return !!v;
@@ -1242,7 +1242,7 @@ int git_parse_maybe_bool(const char *value)
int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
{
int v = git_parse_maybe_bool_text(value);
- if (0 <= v) {
+ if (v >= 0) {
*is_bool = 1;
return v;
}
--
2.32.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] add: avoid yoda condition
2021-06-13 6:37 [PATCH 0/2] Trivial cleanups Felipe Contreras
2021-06-13 6:37 ` [PATCH 1/2] config: avoid yoda conditions Felipe Contreras
@ 2021-06-13 6:37 ` Felipe Contreras
2021-06-15 1:45 ` [PATCH 0/2] Trivial cleanups Junio C Hamano
2 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2021-06-13 6:37 UTC (permalink / raw)
To: git; +Cc: Martin Ågren, Felipe Contreras
18 is younger than person's age.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
builtin/add.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/add.c b/builtin/add.c
index b773b5a499..8c2a5a5094 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -510,7 +510,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
argc--;
argv++;
- if (0 <= addremove_explicit)
+ if (addremove_explicit >= 0)
addremove = addremove_explicit;
else if (take_worktree_changes && ADDREMOVE_DEFAULT)
addremove = 0; /* "-u" was given but not "-A" */
--
2.32.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Trivial cleanups
2021-06-13 6:37 [PATCH 0/2] Trivial cleanups Felipe Contreras
2021-06-13 6:37 ` [PATCH 1/2] config: avoid yoda conditions Felipe Contreras
2021-06-13 6:37 ` [PATCH 2/2] add: avoid yoda condition Felipe Contreras
@ 2021-06-15 1:45 ` Junio C Hamano
2021-06-15 8:22 ` Felipe Contreras
2 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2021-06-15 1:45 UTC (permalink / raw)
To: Felipe Contreras; +Cc: git, Martin Ågren
Felipe Contreras <felipe.contreras@gmail.com> writes:
> These perfeclty good patches from 2014 weren't picked with no good
> reason.
These are safe no-op changes, but that does not mean they are good
patches. It goes against Documentation/CodingGuidelines to bring it
back again now, which is a good enough reason not to look at them.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Trivial cleanups
2021-06-15 1:45 ` [PATCH 0/2] Trivial cleanups Junio C Hamano
@ 2021-06-15 8:22 ` Felipe Contreras
0 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2021-06-15 8:22 UTC (permalink / raw)
To: Junio C Hamano, Felipe Contreras; +Cc: git, Martin Ågren
Junio C Hamano wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
> > These perfeclty good patches from 2014 weren't picked with no good
> > reason.
>
> These are safe no-op changes, but that does not mean they are good
> patches.
They are not good patches because they are no-op, they are good changes
because they correct the flow of the code to match the flow in which
most people think.
18 is younger than Mary
is not a sentence most people would agree make sense.
> It goes against Documentation/CodingGuidelines to bring it
> back again now, which is a good enough reason not to look at them.
These are not style issues. Refactoring code to make it easier to
understand goes beyond style.
Refactoring this:
static int is_same_remote(struct remote *remote)
{
struct remote *fetch_remote = remote_get(NULL);
return (!fetch_remote || fetch_remote == remote);
}
int same_remote = is_same_remote(remote);
To this:
int same_remote = remote == remote_get(NULL);
Is more than just style.
But suit yourself. Sooner or later somebody is going to fix these
glaring mistakes. And they are mistakes [1].
Yoda conditions are widely criticized for compromising readability by
increasing the cognitive load of reading the code.
Cheers.
[1] https://en.wikipedia.org/wiki/Yoda_conditions#Criticism
--
Felipe Contreras
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/2] Trivial cleanups
@ 2014-01-14 17:15 Bjorn Helgaas
0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2014-01-14 17:15 UTC (permalink / raw)
To: linux-pci
No functional change in these. One is just whitespace (this accounts
for all the line deletions), and the other changes "#ifndef ... #else ...
#endif" to the positive form "#ifdef ... #else ... #endif".
I plan these for v3.14 unless there are objections.
---
Bjorn Helgaas (2):
PCI: Reorder so actual code comes before stubs
PCI: Cleanup pci.h whitespace
drivers/pci/pci-label.c | 57 ++++------
include/linux/pci.h | 266 ++++++++++++-----------------------------------
2 files changed, 93 insertions(+), 230 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/2] Trivial cleanups
@ 2009-11-24 7:24 Joe Perches
0 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2009-11-24 7:24 UTC (permalink / raw)
To: Rasesh Mody; +Cc: adapter_linux_open_src_team, netdev
Just a couple of cleanup patches on your latest submission.
Joe Perches (2):
drivers/net/bna: Use pr_<level>, dev_<level>, remove DPRINTK
drivers/net/bna: Use kcalloc
drivers/net/bna/bfa_csdebug.c | 10 +-
drivers/net/bna/bfa_ioc.c | 5 +-
drivers/net/bna/bfad_fwimg.c | 8 +-
drivers/net/bna/bna_fn.c | 7 +-
drivers/net/bna/bna_if.c | 48 ++++------
drivers/net/bna/bnad.c | 216 ++++++++++++++++-------------------------
drivers/net/bna/bnad_compat.h | 13 ---
drivers/net/bna/cna.h | 5 -
8 files changed, 116 insertions(+), 196 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-15 8:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13 6:37 [PATCH 0/2] Trivial cleanups Felipe Contreras
2021-06-13 6:37 ` [PATCH 1/2] config: avoid yoda conditions Felipe Contreras
2021-06-13 6:37 ` [PATCH 2/2] add: avoid yoda condition Felipe Contreras
2021-06-15 1:45 ` [PATCH 0/2] Trivial cleanups Junio C Hamano
2021-06-15 8:22 ` Felipe Contreras
-- strict thread matches above, loose matches on Subject: below --
2014-01-14 17:15 Bjorn Helgaas
2009-11-24 7:24 Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.