Re: [PATCH 06/16] shortlog: add missing declaration
On Thu, Oct 31, 2013 at 2:07 PM, Junio C Hamano wrote: > Felipe Contreras writes: > >> On Thu, Oct 31, 2013 at 1:05 PM, Junio C Hamano wrote: >>> Felipe Contreras writes: >>> Otherwise we would have to include commit.h. >>> >>> Was there a reason why commit.h is not included here, just like >>> revision.h would include diff.h, so that users of shortlog.h do not >>> have to worry about including commit.h themselves? >> >> Because you can't do: >> >> struct diff_options; >> struct diff_options diffopt; >> >> The storage size is not known, but you can do: >> >> struct diff_options; >> struct diff_options *diffopt; > > But so can you do > > struct diff_options *diffopt; > > without the declaration, no? That is: Yes. -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/16] shortlog: add missing declaration
Felipe Contreras writes: > On Thu, Oct 31, 2013 at 1:05 PM, Junio C Hamano wrote: >> Felipe Contreras writes: >> >>> Otherwise we would have to include commit.h. >> >> Was there a reason why commit.h is not included here, just like >> revision.h would include diff.h, so that users of shortlog.h do not >> have to worry about including commit.h themselves? > > Because you can't do: > > struct diff_options; > struct diff_options diffopt; > > The storage size is not known, but you can do: > > struct diff_options; > struct diff_options *diffopt; But so can you do struct diff_options *diffopt; without the declaration, no? That is: $ cat >x.c <<\EOF struct foo { struct bar *ptr; }; int foo_is_null(struct foo *foo) { return foo == 0; } EOF $ gcc -Wall -c x.c -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/16] shortlog: add missing declaration
On Thu, Oct 31, 2013 at 1:05 PM, Junio C Hamano wrote: > Felipe Contreras writes: > >> Otherwise we would have to include commit.h. > > Was there a reason why commit.h is not included here, just like > revision.h would include diff.h, so that users of shortlog.h do not > have to worry about including commit.h themselves? Because you can't do: struct diff_options; struct diff_options diffopt; The storage size is not known, but you can do: struct diff_options; struct diff_options *diffopt; -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/16] shortlog: add missing declaration
Felipe Contreras writes: > Otherwise we would have to include commit.h. Was there a reason why commit.h is not included here, just like revision.h would include diff.h, so that users of shortlog.h do not have to worry about including commit.h themselves? Note: not requesting the patch to be changed; just inquiring the reasoning behind a different approach to solve related/same problem. > Signed-off-by: Felipe Contreras > --- > shortlog.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/shortlog.h b/shortlog.h > index de4f86f..54bc07c 100644 > --- a/shortlog.h > +++ b/shortlog.h > @@ -19,6 +19,8 @@ struct shortlog { > struct string_list mailmap; > }; > > +struct commit; > + > void shortlog_init(struct shortlog *log); > > void shortlog_add_commit(struct shortlog *log, struct commit *commit); -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/16] shortlog: add missing declaration
Otherwise we would have to include commit.h. Signed-off-by: Felipe Contreras --- shortlog.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shortlog.h b/shortlog.h index de4f86f..54bc07c 100644 --- a/shortlog.h +++ b/shortlog.h @@ -19,6 +19,8 @@ struct shortlog { struct string_list mailmap; }; +struct commit; + void shortlog_init(struct shortlog *log); void shortlog_add_commit(struct shortlog *log, struct commit *commit); -- 1.8.4.2+fc1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html