Re: [PATCH 2/2] commit-slab.h: avoid duplicated global static variables

2016-08-09 Thread Junio C Hamano
Johannes Sixt writes: > * like function declarations. I.e., the expansion of > * > *define_commit_slab(indegree, int); > * > - * ends in 'static int stat_indegreerealloc;'. This would otherwise > + * ends in 'struct indegree;'. This would otherwise > * be a syntax error according

Re: [PATCH 2/2] commit-slab.h: avoid duplicated global static variables

2016-08-09 Thread Johannes Sixt
BTW, these are all instances of duplicated global static variables that can be found in a standard Linux build. How I found them? I waded through the error messages produced by compiling the code base as C++ code for the fun of it (basically CFLAGS='-x c++ -fpermissive'). -- Han

[PATCH 2/2] commit-slab.h: avoid duplicated global static variables

2016-08-09 Thread Johannes Sixt
The gigantic define_commit_slab() macro repeats the definition of a static variable that occurs earlier in the macro text. The purpose of the repeated definition at the end of the macro is that it takes the semicolon that occurs where the macro is used. We cannot just remove the first definition o

[PATCH 1/2] config.c: avoid duplicated global static variables

2016-08-09 Thread Johannes Sixt
Repeating the definition of a static variable seems to be valid in C. Nevertheless, it is bad style because it can cause confusion, definitely when it becomes necessary to change the type. d64ec16 (git config: reorganize to use parseopt, 2009-02-21) added two static variables near the top of the

Re: static variables

2013-12-10 Thread Jonathan Nieder
Jonathan Nieder wrote: > Stefan Zager wrote: >> This is probably a naive question, but: there are quite a lot of static >> variables in the git code where it's really unnecessary. Is that just a >> historical artifact, or is there some reason to prefer them? > >

Re: static variables

2013-12-10 Thread Jonathan Nieder
Stefan Zager wrote: > This is probably a naive question, but: there are quite a lot of static > variables in the git code where it's really unnecessary. Is that just a > historical artifact, or is there some reason to prefer them? Sometimes it's for convenience. Other times

static variables

2013-12-10 Thread Stefan Zager
This is probably a naive question, but: there are quite a lot of static variables in the git code where it's really unnecessary. Is that just a historical artifact, or is there some reason to prefer them? I'm working on a patch that will introduce threading, so naturally I'm on

[PATCH 1/6] Rename remote.c's default_remote_name static variables.

2012-07-11 Thread marcnarc
From: Marc Branchaud This prepares the code to handle a true remote.default configuration value. Rename two variables: default_remote_name --> effective_remote_name explicit_default_remote_name --> explicit_effective_remote_name effective_remote_name is the remote name that is curr