git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] very small cleanup: #undef a macro that isn't used anywhere else
@ 2008-11-10 18:28 Francis Galiegue
  2008-11-10 19:09 ` Johannes Schindelin
  0 siblings, 1 reply; 3+ messages in thread
From: Francis Galiegue @ 2008-11-10 18:28 UTC (permalink / raw)
  To: Git Mailing List


In xdiff-interface.c, the FIRST_FEW_BYTES macro is defined, is never used
anwhere else, so we might as well undefine it after we're done with it.
---
 xdiff-interface.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/xdiff-interface.c b/xdiff-interface.c
index e8ef46d..2cf30cd 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -226,6 +226,7 @@ int buffer_is_binary(const char *ptr, unsigned long size)
                size = FIRST_FEW_BYTES;
        return !!memchr(ptr, 0, size);
 }
+#undef FIRST_FEW_BYTES

 struct ff_regs {
        int nr;
--
1.6.0.3


-- 
fge

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] very small cleanup: #undef a macro that isn't used anywhere else
  2008-11-10 18:28 [PATCH] very small cleanup: #undef a macro that isn't used anywhere else Francis Galiegue
@ 2008-11-10 19:09 ` Johannes Schindelin
  2008-11-10 19:09   ` Francis Galiegue
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2008-11-10 19:09 UTC (permalink / raw)
  To: Francis Galiegue; +Cc: Git Mailing List

Hi,

On Mon, 10 Nov 2008, Francis Galiegue wrote:

> In xdiff-interface.c, the FIRST_FEW_BYTES macro is defined, is never 
> used anwhere else, so we might as well undefine it after we're done with 
> it.

Would not the consequence be that we end up with a ton of #undefines all 
over the place, reducing readability incredibly?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] very small cleanup: #undef a macro that isn't used anywhere else
  2008-11-10 19:09 ` Johannes Schindelin
@ 2008-11-10 19:09   ` Francis Galiegue
  0 siblings, 0 replies; 3+ messages in thread
From: Francis Galiegue @ 2008-11-10 19:09 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git Mailing List

Le Monday 10 November 2008 20:09:21 Johannes Schindelin, vous avez écrit :
> Hi,
>
> On Mon, 10 Nov 2008, Francis Galiegue wrote:
> > In xdiff-interface.c, the FIRST_FEW_BYTES macro is defined, is never
> > used anwhere else, so we might as well undefine it after we're done with
> > it.
>
> Would not the consequence be that we end up with a ton of #undefines all
> over the place, reducing readability incredibly?
>

Hmwell, this is a twofold argument, I guess...

* for: the macro is defined, not undefined: it means that potentially, it can 
be used somewhere else in the file; but it isn't (in this case);
* against: macros defined in a C file only ever have scope in said file 
(unless so mischievous Makefile cats two C files together before compile and 
file order is important -- but git doesn't do that), so why #undefine 
anything?

Personally, I'm with the first argument. YMMV, of course.

-- 
fge

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-10 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-10 18:28 [PATCH] very small cleanup: #undef a macro that isn't used anywhere else Francis Galiegue
2008-11-10 19:09 ` Johannes Schindelin
2008-11-10 19:09   ` Francis Galiegue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).