Re: [RFC PATCH 03/10] Add some missing definitions to header files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 5, 2017, 17:42 UTC
- Message-ID
- <xmqq1ss38ako.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170505052729.7576-4-whydoubt@gmail.com>
Jeff Smith <whydoubt@gmail.com> writes:
Show 7 quoted lines
> Signed-off-by: Jeff Smith <whydoubt@gmail.com> > --- > object.h | 2 ++ > pathspec.h | 4 ++++ > refs.h | 3 +++ > tree-walk.h | 2 ++ > 4 files changed, 11 insertions(+)
As the coding rule of this codebase is not to include system headers in anything other than git-compat-util.h which should be the first thing to be included in the *.c files (cache.h and other selected and well-known header files can be the first one in place of git-compat-util, as they include it as the first thing), all changes in this patch, except possibly the one to tree-walk.h, are wrong.
Show 56 quoted lines
>
> diff --git a/object.h b/object.h
> index f52957d..9737582 100644
> --- a/object.h
> +++ b/object.h
> @@ -1,6 +1,8 @@
> #ifndef OBJECT_H
> #define OBJECT_H
>
> +#include "cache.h"
> +
> struct object_list {
> struct object *item;
> struct object_list *next;
> diff --git a/pathspec.h b/pathspec.h
> index 55e9769..ea18e24 100644
> --- a/pathspec.h
> +++ b/pathspec.h
> @@ -1,6 +1,10 @@
> #ifndef PATHSPEC_H
> #define PATHSPEC_H
>
> +#include <stddef.h>
> +#include <string.h>
> +#include <strings.h>
> +
> /* Pathspec magic */
> #define PATHSPEC_FROMTOP (1<<0)
> #define PATHSPEC_MAXDEPTH (1<<1)
> diff --git a/refs.h b/refs.h
> index 07cf4cd..e9d19fd 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -1,6 +1,9 @@
> #ifndef REFS_H
> #define REFS_H
>
> +#include <stdio.h>
> +#include <string.h>
> +
> struct object_id;
> struct ref_store;
> struct strbuf;
> diff --git a/tree-walk.h b/tree-walk.h
> index 68bb78b..8b0fccd 100644
> --- a/tree-walk.h
> +++ b/tree-walk.h
> @@ -1,6 +1,8 @@
> #ifndef TREE_WALK_H
> #define TREE_WALK_H
>
> +struct strbuf;
> +
> struct name_entry {
> const struct object_id *oid;
> const char *path;