[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Meta
From: |
Giuseppe Scrivano |
Subject: |
Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml |
Date: |
Sun, 11 Sep 2016 23:39:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hi Matthew,
Matthew White <address@hidden> writes:
> +void
> +replace_metalink_basename (char **name, char *ref)
> +{
> + size_t dir_len = 0;
> + char *p, *dir, *file, *new;
> +
> + if (!name)
> + return;
> +
> + /* New basename from file name reference. */
> + file = ref;
> + if (file)
> + {
> + p = strrchr (file, '/');
> + if (p)
> + file = p + 1;
> + }
> +
> + /* Old directory. */
> + dir = NULL;
> + if (*name)
> + {
> + p = strrchr (*name, '/');
> + if (p)
> + dir_len = (p - *name) + 1;
> + }
> + dir = xstrndup (*name, dir_len);
I'll review this patch more in details, but one small thing here, could
we modify name in place and avoid a memory allocation for dir?
name[dir_len] = '\0';
Giuseppe
- [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Matthew White, 2016/09/10
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml,
Giuseppe Scrivano <=
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Matthew White, 2016/09/14
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Giuseppe Scrivano, 2016/09/14
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Matthew White, 2016/09/14
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Giuseppe Scrivano, 2016/09/15
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Matthew White, 2016/09/15
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Tim Ruehsen, 2016/09/15
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Matthew White, 2016/09/15
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Tim Ruehsen, 2016/09/16
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Eli Zaretskii, 2016/09/16
- Re: [Bug-wget] [PATCH 20/25] New option --metalink-index to process Metalink application/metalink4+xml, Tim Ruehsen, 2016/09/16