Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] commit-slab-decl.h: fix define gaurds
@ 2020-05-16 17:28 Abhishek Kumar
  2020-05-17 15:44 ` Junio C Hamano
  2020-05-18 14:30 ` [PATCH v2] commit-slab-decl.h: fix define guards Abhishek Kumar
  0 siblings, 2 replies; 6+ messages in thread
From: Abhishek Kumar @ 2020-05-16 17:28 UTC (permalink / raw)
  To: git

commit-slab was split into commit-slab-decl and commit-slab-impl header
files by a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19). The
define guards for commit-slab-decl stll use "COMMIT_SLAB_HDR_H", which
no longer matches the file name. Let's fix this.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
---
 commit-slab-decl.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/commit-slab-decl.h b/commit-slab-decl.h
index adc7b46c83..bfbed1516a 100644
--- a/commit-slab-decl.h
+++ b/commit-slab-decl.h
@@ -1,5 +1,5 @@
-#ifndef COMMIT_SLAB_HDR_H
-#define COMMIT_SLAB_HDR_H
+#ifndef COMMIT_SLAB_DECL_H
+#define COMMIT_SLAB_DECL_H
 
 /* allocate ~512kB at once, allowing for malloc overhead */
 #ifndef COMMIT_SLAB_SIZE
@@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)
 	declare_commit_slab(slabname, elemtype); \
 	declare_commit_slab_prototypes(slabname, elemtype)
 
-#endif /* COMMIT_SLAB_HDR_H */
+#endif /* COMMIT_SLAB_DECL_H */
-- 
2.26.0


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

* Re: [PATCH] commit-slab-decl.h: fix define gaurds
  2020-05-16 17:28 [PATCH] commit-slab-decl.h: fix define gaurds Abhishek Kumar
@ 2020-05-17 15:44 ` Junio C Hamano
  2020-05-18 14:30 ` [PATCH v2] commit-slab-decl.h: fix define guards Abhishek Kumar
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2020-05-17 15:44 UTC (permalink / raw)
  To: Abhishek Kumar; +Cc: git

Abhishek Kumar <abhishekkumar8222@gmail.com> writes:

That's "guard" ;-)

> commit-slab was split into commit-slab-decl and commit-slab-impl header
> files by a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19). The
> define guards for commit-slab-decl stll use "COMMIT_SLAB_HDR_H", which
> no longer matches the file name. Let's fix this.

It would have been helpful to explain that the split did not break
anything because the other half of the split started using a new and
different proprocessor macro before saying "Let's fix".

It would have been "broken" that needs "fixing" if two headers
inherited the use of the same _HDR_H preprocessor macro, of course.

The patch obviously looks good.

> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
> ---
>  commit-slab-decl.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/commit-slab-decl.h b/commit-slab-decl.h
> index adc7b46c83..bfbed1516a 100644
> --- a/commit-slab-decl.h
> +++ b/commit-slab-decl.h
> @@ -1,5 +1,5 @@
> -#ifndef COMMIT_SLAB_HDR_H
> -#define COMMIT_SLAB_HDR_H
> +#ifndef COMMIT_SLAB_DECL_H
> +#define COMMIT_SLAB_DECL_H
>  
>  /* allocate ~512kB at once, allowing for malloc overhead */
>  #ifndef COMMIT_SLAB_SIZE
> @@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)
>  	declare_commit_slab(slabname, elemtype); \
>  	declare_commit_slab_prototypes(slabname, elemtype)
>  
> -#endif /* COMMIT_SLAB_HDR_H */
> +#endif /* COMMIT_SLAB_DECL_H */

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

* [PATCH v2] commit-slab-decl.h: fix define guards
  2020-05-16 17:28 [PATCH] commit-slab-decl.h: fix define gaurds Abhishek Kumar
  2020-05-17 15:44 ` Junio C Hamano
@ 2020-05-18 14:30 ` Abhishek Kumar
  2020-05-18 17:12   ` Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Abhishek Kumar @ 2020-05-18 14:30 UTC (permalink / raw)
  To: git

a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19) split commit-slab
into commit-slab-decl and commit-slab-impl header files. The define
guards for commit-slab-decl still use "COMMIT_SLAB_HDR_H". Fortunately,
commit-slab-impl introduced its own macro, "COMMIT_SLAB_IMPL_H".
Otherwise, the code would have been broken by not including
commit-slab-impl.

Let's correct the define guards for commit-slab-decl to match file name.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
---
 commit-slab-decl.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/commit-slab-decl.h b/commit-slab-decl.h
index adc7b46c83..bfbed1516a 100644
--- a/commit-slab-decl.h
+++ b/commit-slab-decl.h
@@ -1,5 +1,5 @@
-#ifndef COMMIT_SLAB_HDR_H
-#define COMMIT_SLAB_HDR_H
+#ifndef COMMIT_SLAB_DECL_H
+#define COMMIT_SLAB_DECL_H
 
 /* allocate ~512kB at once, allowing for malloc overhead */
 #ifndef COMMIT_SLAB_SIZE
@@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)
 	declare_commit_slab(slabname, elemtype); \
 	declare_commit_slab_prototypes(slabname, elemtype)
 
-#endif /* COMMIT_SLAB_HDR_H */
+#endif /* COMMIT_SLAB_DECL_H */
-- 
2.26.0


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

* Re: [PATCH v2] commit-slab-decl.h: fix define guards
  2020-05-18 14:30 ` [PATCH v2] commit-slab-decl.h: fix define guards Abhishek Kumar
@ 2020-05-18 17:12   ` Junio C Hamano
  2020-05-18 17:29     ` Eric Sunshine
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2020-05-18 17:12 UTC (permalink / raw)
  To: Abhishek Kumar; +Cc: git

Abhishek Kumar <abhishekkumar8222@gmail.com> writes:

> a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19) split commit-slab
> ...

I've rephrased the log message a bit more before queuing, since I
did not find many hits for "define guards" but the search engine
found quite a common use of "include guard".

Thanks.


-- >8 --
From: Abhishek Kumar <abhishekkumar8222@gmail.com>
Subject: [PATCH] commit-slab-decl.h: update include guard

When a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19) split
commit-slab.h into commit-slab-decl.h and commit-slab-impl.h header
files, commit-slab-decl.h were left use "COMMIT_SLAB_HDR_H", while
commit-slab-impl.h gained its own macro, "COMMIT_SLAB_IMPL_H".

As these two files use different include guards, there is nothing
broken, but let's update commit-slab-decl.h to match the convention
to name the include guard after the filename.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit-slab-decl.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/commit-slab-decl.h b/commit-slab-decl.h
index adc7b46c83..bfbed1516a 100644
--- a/commit-slab-decl.h
+++ b/commit-slab-decl.h
@@ -1,5 +1,5 @@
-#ifndef COMMIT_SLAB_HDR_H
-#define COMMIT_SLAB_HDR_H
+#ifndef COMMIT_SLAB_DECL_H
+#define COMMIT_SLAB_DECL_H
 
 /* allocate ~512kB at once, allowing for malloc overhead */
 #ifndef COMMIT_SLAB_SIZE
@@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)
 	declare_commit_slab(slabname, elemtype); \
 	declare_commit_slab_prototypes(slabname, elemtype)
 
-#endif /* COMMIT_SLAB_HDR_H */
+#endif /* COMMIT_SLAB_DECL_H */
-- 
2.27.0-rc0


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

* Re: [PATCH v2] commit-slab-decl.h: fix define guards
  2020-05-18 17:12   ` Junio C Hamano
@ 2020-05-18 17:29     ` Eric Sunshine
  2020-05-18 17:32       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Sunshine @ 2020-05-18 17:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Abhishek Kumar, Git List

On Mon, May 18, 2020 at 1:14 PM Junio C Hamano <gitster@pobox.com> wrote:
> From: Abhishek Kumar <abhishekkumar8222@gmail.com>
> Subject: [PATCH] commit-slab-decl.h: update include guard
>
> When a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19) split
> commit-slab.h into commit-slab-decl.h and commit-slab-impl.h header
> files, commit-slab-decl.h were left use "COMMIT_SLAB_HDR_H", while

s/were left use/was left using/

> commit-slab-impl.h gained its own macro, "COMMIT_SLAB_IMPL_H".
>
> As these two files use different include guards, there is nothing
> broken, but let's update commit-slab-decl.h to match the convention
> to name the include guard after the filename.
>
> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

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

* Re: [PATCH v2] commit-slab-decl.h: fix define guards
  2020-05-18 17:29     ` Eric Sunshine
@ 2020-05-18 17:32       ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2020-05-18 17:32 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Abhishek Kumar, Git List

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Mon, May 18, 2020 at 1:14 PM Junio C Hamano <gitster@pobox.com> wrote:
>> From: Abhishek Kumar <abhishekkumar8222@gmail.com>
>> Subject: [PATCH] commit-slab-decl.h: update include guard
>>
>> When a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19) split
>> commit-slab.h into commit-slab-decl.h and commit-slab-impl.h header
>> files, commit-slab-decl.h were left use "COMMIT_SLAB_HDR_H", while
>
> s/were left use/was left using/

Thanks, I meant to say "left to use" actually.



>> commit-slab-impl.h gained its own macro, "COMMIT_SLAB_IMPL_H".
>>
>> As these two files use different include guards, there is nothing
>> broken, but let's update commit-slab-decl.h to match the convention
>> to name the include guard after the filename.
>>
>> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16 17:28 [PATCH] commit-slab-decl.h: fix define gaurds Abhishek Kumar
2020-05-17 15:44 ` Junio C Hamano
2020-05-18 14:30 ` [PATCH v2] commit-slab-decl.h: fix define guards Abhishek Kumar
2020-05-18 17:12   ` Junio C Hamano
2020-05-18 17:29     ` Eric Sunshine
2020-05-18 17:32       ` Junio C Hamano

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git