Re: [PATCH v4 02/11] Add initial support for many promisor remotes

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

 



On Thu, Apr 4, 2019 at 12:08 AM SZEDER Gábor <szeder.dev@xxxxxxxxx> wrote:
>
> On Mon, Apr 01, 2019 at 06:40:36PM +0200, Christian Couder wrote:
> > diff --git a/promisor-remote.c b/promisor-remote.c
> > new file mode 100644
> > index 0000000000..0c768210ee
> > --- /dev/null
> > +++ b/promisor-remote.c
> > @@ -0,0 +1,92 @@
> > +#include "cache.h"
> > +#include "promisor-remote.h"
> > +#include "config.h"
> > +
> > +static struct promisor_remote *promisors;
> > +static struct promisor_remote **promisors_tail = &promisors;
> > +
> > +static struct promisor_remote *promisor_remote_new(const char *remote_name)
> > +{
> > +     struct promisor_remote *r;
> > +
> > +     if (*remote_name == '/') {
> > +             warning(_("promisor remote name cannot begin with '/': %s"),
> > +                     remote_name);
> > +             return NULL;
> > +     }
> > +
> > +     FLEX_ALLOC_STR(r, name, remote_name);
> > +
> > +     *promisors_tail = r;
> > +     promisors_tail = &r->next;
> > +
> > +     return r;
> > +}
> > +
> > +static struct promisor_remote *promisor_remote_lookup(const char *remote_name,
> > +                                                   struct promisor_remote **previous)
> > +{
> > +     struct promisor_remote *r, *p;
> > +
> > +     for (p = NULL, r = promisors; r; p = r, r = r->next)
> > +             if (r->name && !strcmp(r->name, remote_name)) {
>
> r->name is a FLEX_ARRAY, and Clang complains about this condition:
>
>   promisor-remote.c:34:10: error: address of array 'r->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
>                   if (r->name && !strcmp(r->name, remote_name)) {
>                       ~~~^~~~ ~~
>   1 error generated.
>   make: *** [promisor-remote.o] Error 1

Yeah, it's a left over from the previous version where it wasn't a FLEX_ARRAY.

Thanks!




[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