Re: [PATCH] fetch: avoid quadratic loop checking for updated submodules

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

 



Hi Peff,

On Mon, Sep 12, 2011 at 9:56 PM, Jeff King <peff@xxxxxxxx> wrote:
> diff --git a/submodule.c b/submodule.c
> index 7a76edf..00aeb71 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -8,12 +8,17 @@
>  #include "diffcore.h"
>  #include "refs.h"
>  #include "string-list.h"
> +#include "sha1-array.h"

Nice to see you reuse sha1-array!

[...]

> +struct argv_array {
> +       const char **argv;
> +       unsigned int argc;
> +       unsigned int alloc;
> +};

But there is already such a struct in bisect.c!

> +static void init_argv(struct argv_array *array)
> +{
> +       array->argv = NULL;
> +       array->argc = 0;
> +       array->alloc = 0;
> +}
> +
> +static void push_argv(struct argv_array *array, const char *value)
> +{
> +       ALLOC_GROW(array->argv, array->argc + 2, array->alloc);
> +       array->argv[array->argc++] = xstrdup(value);
> +       array->argv[array->argc] = NULL;
> +}
> +
> +static void clear_argv(struct argv_array *array)
> +{
> +       int i;
> +       for (i = 0; i < array->argc; i++)
> +               free((char **)array->argv[i]);
> +       free(array->argv);
> +       init_argv(array);
> +}
> +
> +static void add_sha1_to_argv(const unsigned char sha1[20], void *data)
> +{
> +       push_argv(data, sha1_to_hex(sha1));
> +}

So it would be nice if you could refactor this and the argv_array
functions in bisect.c in the same way you refactored sha1-array.

Thanks,
Christian.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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