{"thread":{"id":"53487","subject":"[PATCH] commit-slab-decl.h: fix define gaurds","startedAt":"2020-05-16T17:30:10Z","lastAt":"2020-05-18T17:32:57Z","messageCount":6,"participants":["Abhishek Kumar","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"397978","messageId":"20200516172837.2872-1-abhishekkumar8222@gmail.com","threadId":"53487","inReplyTo":null,"subject":"[PATCH] commit-slab-decl.h: fix define gaurds","fromName":"Abhishek Kumar","fromEmail":"abhishekkumar8222@gmail.com","sentAt":"2020-05-16T17:28:37Z","receivedAt":"2020-05-16T17:30:10Z","isPatch":true,"sender":{"key":"abhishekkumar8222@gmail.com","avatar":"https://avatars.githubusercontent.com/u/31231064?v=4"},"body":"commit-slab was split into commit-slab-decl and commit-slab-impl header\nfiles by a9f1f1f9f8 (\"commit-slab.h: code split\", 2018-05-19). The\ndefine guards for commit-slab-decl stll use \"COMMIT_SLAB_HDR_H\", which\nno longer matches the file name. Let's fix this.\n\nSigned-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\n---\n commit-slab-decl.h | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/commit-slab-decl.h b/commit-slab-decl.h\nindex adc7b46c83..bfbed1516a 100644\n--- a/commit-slab-decl.h\n+++ b/commit-slab-decl.h\n@@ -1,5 +1,5 @@\n-#ifndef COMMIT_SLAB_HDR_H\n-#define COMMIT_SLAB_HDR_H\n+#ifndef COMMIT_SLAB_DECL_H\n+#define COMMIT_SLAB_DECL_H\n \n /* allocate ~512kB at once, allowing for malloc overhead */\n #ifndef COMMIT_SLAB_SIZE\n@@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)\n \tdeclare_commit_slab(slabname, elemtype); \\\n \tdeclare_commit_slab_prototypes(slabname, elemtype)\n \n-#endif /* COMMIT_SLAB_HDR_H */\n+#endif /* COMMIT_SLAB_DECL_H */\n-- \n2.26.0\n\n"},{"id":"398012","messageId":"xmqqd0727ehv.fsf@gitster.c.googlers.com","threadId":"53487","inReplyTo":"20200516172837.2872-1-abhishekkumar8222@gmail.com","subject":"Re: [PATCH] commit-slab-decl.h: fix define gaurds","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-17T15:44:28Z","receivedAt":"2020-05-17T15:44:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Abhishek Kumar <abhishekkumar8222@gmail.com> writes:\n\nThat's \"guard\" ;-)\n\n> commit-slab was split into commit-slab-decl and commit-slab-impl header\n> files by a9f1f1f9f8 (\"commit-slab.h: code split\", 2018-05-19). The\n> define guards for commit-slab-decl stll use \"COMMIT_SLAB_HDR_H\", which\n> no longer matches the file name. Let's fix this.\n\nIt would have been helpful to explain that the split did not break\nanything because the other half of the split started using a new and\ndifferent proprocessor macro before saying \"Let's fix\".\n\nIt would have been \"broken\" that needs \"fixing\" if two headers\ninherited the use of the same _HDR_H preprocessor macro, of course.\n\nThe patch obviously looks good.\n\n> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\n> ---\n>  commit-slab-decl.h | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/commit-slab-decl.h b/commit-slab-decl.h\n> index adc7b46c83..bfbed1516a 100644\n> --- a/commit-slab-decl.h\n> +++ b/commit-slab-decl.h\n> @@ -1,5 +1,5 @@\n> -#ifndef COMMIT_SLAB_HDR_H\n> -#define COMMIT_SLAB_HDR_H\n> +#ifndef COMMIT_SLAB_DECL_H\n> +#define COMMIT_SLAB_DECL_H\n>  \n>  /* allocate ~512kB at once, allowing for malloc overhead */\n>  #ifndef COMMIT_SLAB_SIZE\n> @@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)\n>  \tdeclare_commit_slab(slabname, elemtype); \\\n>  \tdeclare_commit_slab_prototypes(slabname, elemtype)\n>  \n> -#endif /* COMMIT_SLAB_HDR_H */\n> +#endif /* COMMIT_SLAB_DECL_H */\n"},{"id":"398070","messageId":"20200518143023.14217-1-abhishekkumar8222@gmail.com","threadId":"53487","inReplyTo":"20200516172837.2872-1-abhishekkumar8222@gmail.com","subject":"[PATCH v2] commit-slab-decl.h: fix define guards","fromName":"Abhishek Kumar","fromEmail":"abhishekkumar8222@gmail.com","sentAt":"2020-05-18T14:30:23Z","receivedAt":"2020-05-18T14:31:59Z","isPatch":true,"sender":{"key":"abhishekkumar8222@gmail.com","avatar":"https://avatars.githubusercontent.com/u/31231064?v=4"},"body":"a9f1f1f9f8 (\"commit-slab.h: code split\", 2018-05-19) split commit-slab\ninto commit-slab-decl and commit-slab-impl header files. The define\nguards for commit-slab-decl still use \"COMMIT_SLAB_HDR_H\". Fortunately,\ncommit-slab-impl introduced its own macro, \"COMMIT_SLAB_IMPL_H\".\nOtherwise, the code would have been broken by not including\ncommit-slab-impl.\n\nLet's correct the define guards for commit-slab-decl to match file name.\n\nSigned-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\n---\n commit-slab-decl.h | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/commit-slab-decl.h b/commit-slab-decl.h\nindex adc7b46c83..bfbed1516a 100644\n--- a/commit-slab-decl.h\n+++ b/commit-slab-decl.h\n@@ -1,5 +1,5 @@\n-#ifndef COMMIT_SLAB_HDR_H\n-#define COMMIT_SLAB_HDR_H\n+#ifndef COMMIT_SLAB_DECL_H\n+#define COMMIT_SLAB_DECL_H\n \n /* allocate ~512kB at once, allowing for malloc overhead */\n #ifndef COMMIT_SLAB_SIZE\n@@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)\n \tdeclare_commit_slab(slabname, elemtype); \\\n \tdeclare_commit_slab_prototypes(slabname, elemtype)\n \n-#endif /* COMMIT_SLAB_HDR_H */\n+#endif /* COMMIT_SLAB_DECL_H */\n-- \n2.26.0\n\n"},{"id":"398104","messageId":"xmqqsgfx415z.fsf@gitster.c.googlers.com","threadId":"53487","inReplyTo":"20200518143023.14217-1-abhishekkumar8222@gmail.com","subject":"Re: [PATCH v2] commit-slab-decl.h: fix define guards","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-18T17:12:56Z","receivedAt":"2020-05-18T17:13:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Abhishek Kumar <abhishekkumar8222@gmail.com> writes:\n\n> a9f1f1f9f8 (\"commit-slab.h: code split\", 2018-05-19) split commit-slab\n> ...\n\nI've rephrased the log message a bit more before queuing, since I\ndid not find many hits for \"define guards\" but the search engine\nfound quite a common use of \"include guard\".\n\nThanks.\n\n\n-- >8 --\nFrom: Abhishek Kumar <abhishekkumar8222@gmail.com>\nSubject: [PATCH] commit-slab-decl.h: update include guard\n\nWhen a9f1f1f9f8 (\"commit-slab.h: code split\", 2018-05-19) split\ncommit-slab.h into commit-slab-decl.h and commit-slab-impl.h header\nfiles, commit-slab-decl.h were left use \"COMMIT_SLAB_HDR_H\", while\ncommit-slab-impl.h gained its own macro, \"COMMIT_SLAB_IMPL_H\".\n\nAs these two files use different include guards, there is nothing\nbroken, but let's update commit-slab-decl.h to match the convention\nto name the include guard after the filename.\n\nSigned-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n commit-slab-decl.h | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/commit-slab-decl.h b/commit-slab-decl.h\nindex adc7b46c83..bfbed1516a 100644\n--- a/commit-slab-decl.h\n+++ b/commit-slab-decl.h\n@@ -1,5 +1,5 @@\n-#ifndef COMMIT_SLAB_HDR_H\n-#define COMMIT_SLAB_HDR_H\n+#ifndef COMMIT_SLAB_DECL_H\n+#define COMMIT_SLAB_DECL_H\n \n /* allocate ~512kB at once, allowing for malloc overhead */\n #ifndef COMMIT_SLAB_SIZE\n@@ -40,4 +40,4 @@ elemtype *slabname## _peek(struct slabname *s, const struct commit *c)\n \tdeclare_commit_slab(slabname, elemtype); \\\n \tdeclare_commit_slab_prototypes(slabname, elemtype)\n \n-#endif /* COMMIT_SLAB_HDR_H */\n+#endif /* COMMIT_SLAB_DECL_H */\n-- \n2.27.0-rc0\n\n"},{"id":"398111","messageId":"CAPig+cTFp0rHkYUwxvRJUWLBsV8gt-qL=UNVBB=+oTCkpe0oyA@mail.gmail.com","threadId":"53487","inReplyTo":"xmqqsgfx415z.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v2] commit-slab-decl.h: fix define guards","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-05-18T17:29:08Z","receivedAt":"2020-05-18T17:29:22Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, May 18, 2020 at 1:14 PM Junio C Hamano <gitster@pobox.com> wrote:\n> From: Abhishek Kumar <abhishekkumar8222@gmail.com>\n> Subject: [PATCH] commit-slab-decl.h: update include guard\n>\n> When a9f1f1f9f8 (\"commit-slab.h: code split\", 2018-05-19) split\n> commit-slab.h into commit-slab-decl.h and commit-slab-impl.h header\n> files, commit-slab-decl.h were left use \"COMMIT_SLAB_HDR_H\", while\n\ns/were left use/was left using/\n\n> commit-slab-impl.h gained its own macro, \"COMMIT_SLAB_IMPL_H\".\n>\n> As these two files use different include guards, there is nothing\n> broken, but let's update commit-slab-decl.h to match the convention\n> to name the include guard after the filename.\n>\n> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"},{"id":"398114","messageId":"xmqqblml408u.fsf@gitster.c.googlers.com","threadId":"53487","inReplyTo":"CAPig+cTFp0rHkYUwxvRJUWLBsV8gt-qL=UNVBB=+oTCkpe0oyA@mail.gmail.com","subject":"Re: [PATCH v2] commit-slab-decl.h: fix define guards","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-18T17:32:49Z","receivedAt":"2020-05-18T17:32:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Mon, May 18, 2020 at 1:14 PM Junio C Hamano <gitster@pobox.com> wrote:\n>> From: Abhishek Kumar <abhishekkumar8222@gmail.com>\n>> Subject: [PATCH] commit-slab-decl.h: update include guard\n>>\n>> When a9f1f1f9f8 (\"commit-slab.h: code split\", 2018-05-19) split\n>> commit-slab.h into commit-slab-decl.h and commit-slab-impl.h header\n>> files, commit-slab-decl.h were left use \"COMMIT_SLAB_HDR_H\", while\n>\n> s/were left use/was left using/\n\nThanks, I meant to say \"left to use\" actually.\n\n\n\n>> commit-slab-impl.h gained its own macro, \"COMMIT_SLAB_IMPL_H\".\n>>\n>> As these two files use different include guards, there is nothing\n>> broken, but let's update commit-slab-decl.h to match the convention\n>> to name the include guard after the filename.\n>>\n>> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\n>> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"}]}