Re: [PATCH v3 14/35] connect: request remote refs using v2
- From
Jeff King <peff@peff.net>
- Date
- Feb 27, 2018, 22:18 UTC
- Message-ID
- <20180227221808.GE11187@sigill.intra.peff.net>
- In-Reply-To
- <CAPig+cS+G-xC51n-Ud0Wbmcc-zeHBM3-5WQQAFm9gwm9LNk3Gg@mail.gmail.com>
On Tue, Feb 27, 2018 at 05:10:09PM -0500, Eric Sunshine wrote:
Show 23 quoted lines
> > That would be fine with me. Though I would love it if we could find a
> > shorter name for the associated functions. For example,
> > argv_array_pushf() can make lines quite long, and something like
> > argv_pushf() is easier to read (in my opinion). And that might work
> > because "argv" is pretty unique by itself, but "string" is not.
> >
> > Some one-word name like "strarray" might work, though I find that is not
> > quite catchy. I guess "strv" is short if you assume that people know the
> > "v" suffix means "vector".
>
> struct strs {...};
>
> void strs_init(struct strs *);
> void strs_push(struct strs *, const char *);
> void strs_pushf(struct strs *, const char *fmt, ...);
> void strs_pushl(struct strs *, ...);
> void strs_pushv(struct strs *, const char **);
> void strs_pop(struct strs *);
> void strs_clear(struct strs *);
> const char **strs_detach(struct strs *);
>
> ...is short, feels pretty natural, and doesn't require understanding
> "v" for "vector".Not bad. The "v" carries the information that it _is_ a NULL-terminated vector and not some other list-like structure (and so is suitable for feeding to execv, etc). But that may just be obvious from looking at its uses and documentation.
-Peff