From af920e369778a4cc42519ef523131d29451bf79b Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 9 Aug 2016 16:17:56 +0200 Subject: commit-slab.h: avoid duplicated global static variables 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 of the variable because it is referenced elsewhere in the macro text, and defining the macro later would produce undefined identifier errors. We cannot have a "forward" declaration, either. (This works only with "extern" global variables.) The solution is to use a declaration of a struct that is already defined earlier. This language construct can serve the same purpose as the duplicated static variable definition, but without the confusion. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- commit-slab.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'commit-slab.h') diff --git a/commit-slab.h b/commit-slab.h index f37ec3831..c10b2539f 100644 --- a/commit-slab.h +++ b/commit-slab.h @@ -102,16 +102,16 @@ static MAYBE_UNUSED elemtype *slabname## _at(struct slabname *s, \ return &s->slab[nth_slab][nth_slot * s->stride]; \ } \ \ -static int stat_ ##slabname## realloc +struct slabname /* - * Note that this seemingly redundant second declaration is required + * Note that this redundant forward declaration is required * to allow a terminating semicolon, which makes instantiations look * 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 (at least) to ISO C. It's hard to * catch because GCC silently parses it by default. */ -- cgit v1.2.1 From 2e3a16b279a9df2e498187871c67e623e12bc8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 9 Aug 2016 11:53:38 +0300 Subject: Spelling fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit accidently accidentally commited committed dependancy dependency emtpy empty existance existence explicitely explicitly git-upload-achive git-upload-archive hierachy hierarchy indegee indegree intial initial mulitple multiple non-existant non-existent precendence. precedence. priviledged privileged programatically programmatically psuedo-binary pseudo-binary soemwhere somewhere successfull successful transfering transferring uncommited uncommitted unkown unknown usefull useful writting writing Signed-off-by: Ville Skyttä Signed-off-by: Junio C Hamano --- commit-slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commit-slab.h') diff --git a/commit-slab.h b/commit-slab.h index f84b44941..be16da772 100644 --- a/commit-slab.h +++ b/commit-slab.h @@ -8,7 +8,7 @@ * * After including this header file, using: * - * define_commit_slab(indegee, int); + * define_commit_slab(indegree, int); * * will let you call the following functions: * -- cgit v1.2.1