Re: [PATCH v2 03/10] compat: introduce new "zlib.h" header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick Steinhardt <ps@xxxxxx> writes:

> Introduce a new "compat/zlib-compat.h" header that we include instead of
> including <zlib.h> directly. This will allow us to wire up zlib-ng as an
> alternative backend for zlib compression in a subsequent commit.
>
> Note that we cannot just call the file "compat/zlib.h", as that may
> otherwise cause us to include that file instead of <zlib.h>.
>

TIL. This would be an issue if we added "compat/" to the list of paths
the compiler checks for headers no? I couldn't find anything in our
Makefile doing this, or did I miss it?

> Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> ---
>  compat/zlib-compat.h | 6 ++++++
>  git-compat-util.h    | 2 +-
>  reftable/block.c     | 2 +-
>  3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h
> new file mode 100644
> index 0000000000000000000000000000000000000000..bc20b884efab72028d5f696923e9800e39b08ce3
> --- /dev/null
> +++ b/compat/zlib-compat.h
> @@ -0,0 +1,6 @@
> +#ifndef COMPAT_ZLIB_H
> +#define COMPAT_ZLIB_H
> +
> +#include <zlib.h>
> +
> +#endif /* COMPAT_ZLIB_H */
> diff --git a/git-compat-util.h b/git-compat-util.h
> index c4b4b372b473ca0af2a4f5f60554f6d3df74f112..1ca26713221ba0270818ac61b6940f03cdf8b460 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -1537,7 +1537,7 @@ int cmd_main(int, const char **);
>  int common_exit(const char *file, int line, int code);
>  #define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))
>
> -#include <zlib.h>
> +#include "compat/zlib-compat.h"
>
>  /*
>   * This include must come after system headers, since it introduces macros that
> diff --git a/reftable/block.c b/reftable/block.c
> index 9858bbc7c5f7aa63fbcaf1acf9f4b5738e0b6d27..bc9b07963448e613ae14d2c4194b48764718290d 100644
> --- a/reftable/block.c
> +++ b/reftable/block.c
> @@ -13,7 +13,7 @@ license that can be found in the LICENSE file or at
>  #include "record.h"
>  #include "reftable-error.h"
>  #include "system.h"
> -#include <zlib.h>
> +#include "compat/zlib-compat.h"
>
>  int header_size(int version)
>  {
>
> --
> 2.48.0.257.gd3603152ad.dirty

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux