Re: [PATCH v6 04/20] reftable: utility functions

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

 



On Mon, Apr 12 2021, Han-Wen Nienhuys via GitGitGadget wrote:

> diff --git a/reftable/system.h b/reftable/system.h
> new file mode 100644
> index 000000000000..07277ca06273
> --- /dev/null
> +++ b/reftable/system.h
> @@ -0,0 +1,32 @@
> +/*
> +Copyright 2020 Google LLC
> +
> +Use of this source code is governed by a BSD-style
> +license that can be found in the LICENSE file or at
> +https://developers.google.com/open-source/licenses/bsd
> +*/
> +
> +#ifndef SYSTEM_H
> +#define SYSTEM_H
> +
> +#include "git-compat-util.h"
> +#include "strbuf.h"
> +
> +#include <zlib.h>
> +
> +struct strbuf;
> +/* In git, this is declared in dir.h */
> +int remove_dir_recursively(struct strbuf *path, int flags);
> +
> +#define SHA1_ID 0x73686131
> +#define SHA256_ID 0x73323536
> +#define SHA1_SIZE 20
> +#define SHA256_SIZE 32
> +
> +/* This is uncompress2, which is only available in zlib as of 2017.
> + */
> +int uncompress_return_consumed(Bytef *dest, uLongf *destLen,
> +			       const Bytef *source, uLong *sourceLen);
> +int hash_size(uint32_t id);

Related to the comment in
http://lore.kernel.org/git/87a6q2egvy.fsf@xxxxxxxxxxxxxxxxxxx

I'd think that rather than duplicating magic constants & one thing in
dir.h we'd be better off having some leading patches splitting off the
relevant parts of object-file.c & dir.h, maybe THAT_NAME_minimal.h?

Or: why not simply include dir.h and object.h etc? The compiler/linker
will discard the unused functions, and if the worry is overuse of
git.git functions creeping in I'd think that would be better done via
some test/CI job that checks what objects were used.



[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