Re: [PATCH 1/4] Add history graph API
- From
Adam Simpkins <adam@adamsimpkins.net>
- Date
- Apr 6, 2008, 22:58 UTC
- Message-ID
- <20080406225819.GE5822@adamsimpkins.net>
- In-Reply-To
- <alpine.DEB.1.00.0804062315090.12583@eeepc-johanness>
On Sun, Apr 06, 2008 at 11:15:58PM +0100, Johannes Schindelin wrote:
Show 17 quoted lines
> On Sun, 6 Apr 2008, Adam Simpkins wrote: > > On Sun, Apr 06, 2008 at 10:06:24PM +0100, Johannes Schindelin wrote: > > > On Sun, 6 Apr 2008, Adam Simpkins wrote: > > > > > > > +/* Defined in commit.h */ > > > > +struct commit; > > > > +/* Defined in strbuf.h */ > > > > +struct strbuf; > > > > > > You do not need those. > > > > I added them so that graph.h can be included without including any other > > header files first. They can be taken out if we assume that all users > > of graph.h will include commit.h and strbuf.h first. > > AFAICT you do not even need them then. Using "struct strbuf *" without > ever declaring struct strbuf before that is perfectly valid.
Trying to compile the following test code with gcc 4.1.2 results in a warning.
test.c:
#include <stdio.h>
void test(struct strbuf *sb);
int main(int argc, char **argv)
{
test(NULL);
return 0;
}$ gcc -c test.c test.c:3: warning: ‘struct strbuf’ declared inside parameter list test.c:3: warning: its scope is only this definition or declaration, which is probably not what you want
-- Adam Simpkins adam@adamsimpkins.net