Re: [PATCH 03/28] packed_ref_store: move `packed_refs_path` here

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

 



On Thu, Jun 15, 2017 at 7:47 AM, Michael Haggerty <mhagger@xxxxxxxxxxxx> wrote:
> Move `packed_refs_path` from `files_ref_store` to `packed_ref_store`,
> and rename it to `path` since its meaning is clear from its new
> context.
>
> Inline `files_packed_refs_path()`.
>
> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>
> ---
>  refs/files-backend.c | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 2efb71cee9..c4b8e2f63b 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -54,6 +54,9 @@ struct packed_ref_cache {
>  struct packed_ref_store {
>         unsigned int store_flags;
>
> +       /* The path of the "packed-refs" file: */
> +       char *path;
> +
>         /*
>          * A cache of the values read from the `packed-refs` file, if
>          * it might still be current; otherwise, NULL.
> @@ -61,11 +64,13 @@ struct packed_ref_store {
>         struct packed_ref_cache *cache;
>  };
>
> -static struct packed_ref_store *packed_ref_store_create(unsigned int store_flags)
> +static struct packed_ref_store *packed_ref_store_create(
> +               const char *path, unsigned int store_flags)
>  {
>         struct packed_ref_store *refs = xcalloc(1, sizeof(*refs));
>
>         refs->store_flags = store_flags;
> +       refs->path = xstrdup(path);

mental note: the destructor (if introduced later) has to
free the path.



[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]