Download raw body.
avoid per tree-entry asprintf/free
Stefan Sperling <stsp@stsp.name> wrote:
> Avoid doing asprintf/free per tree entry in got_pack_load_tree_entries().
>
> Allocate one path buffer and keep growing it as needed. For directories we
> still need to copy the path. But blobs can use the path buffer directly.
>
> ok?
okay op with a nit:
> M lib/pack_create.c | 38+ 11-
>
> 1 file changed, 38 insertions(+), 11 deletions(-)
>
> commit - 23c16b295963fd2cfddf454ef642b1dfb6afa3d1
> commit + bf9514555f3e1bcbc972ed5f791d2cf0a9c797e6
> blob - 88ae6a7f7857b14079689f7c4e8f26ef6cebdfce
> blob + 0e3b3d8caf3352ddb1c89e6e64acc9d0897aa079
> --- lib/pack_create.c
> +++ lib/pack_create.c
> @@ -797,7 +797,7 @@ got_pack_load_tree_entries(struct got_object_id_queue
> {
> const struct got_error *err;
> char *p = NULL;
> - int i;
> + int i, ret, psize = _POSIX_PATH_MAX;
can we use PATH_MAX instead?
$ grep -R PATH_MAX | grep -vc _POSIX
88
$ grep -R POSIX_PATH_MAX | wc -l
15
we seem to have a preference for PATH_MAX and, as far as I know, unlike
HOST_NAME_MAX which is problematic in portable, PATH_MAX is generally
okay.
(plus I'd like to avoid these _POSIX_* spelling if possible)
> (*ntrees)++;
> err = got_pack_report_progress(progress_cb, progress_arg, rl,
avoid per tree-entry asprintf/free