Skip to contentSkip to conversation

very small cleanup: #undef a macro that isn't used anywhere else

PATCH In review Francis Galiegue 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 very small cleanup: #undef a macro that isn't used anywhere else

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(-)
xdiff-interface.c +1 -0
index e8ef46d..2cf30cd 100644
@@ -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

Signature · 1 line
fge
#1 lore raw

Hi,

Quoted 3 lines · Francis Galiegue

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

#2 lore raw

Le Monday 10 November 2008 20:09:21 Johannes Schindelin, vous avez écrit :

Quoted 10 lines

Hi,

Quoted 3 lines · Francis Galiegue

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.

Signature · 1 line
fge