[Mesa-dev] [PATCH 1/9] util/dynarray: add a clone function

Jason Ekstrand jason at jlekstrand.net
Wed Aug 22 17:30:11 UTC 2018


On Thu, Aug 16, 2018 at 12:30 AM Thomas Helland <thomashelland90 at gmail.com>
wrote:

> 2018-08-15 23:56 GMT+02:00 Caio Marcelo de Oliveira Filho
> <caio.oliveira at intel.com>:
> > ---
> >  src/util/u_dynarray.h | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/src/util/u_dynarray.h b/src/util/u_dynarray.h
> > index dcbbc06d161..4920fe04b67 100644
> > --- a/src/util/u_dynarray.h
> > +++ b/src/util/u_dynarray.h
> > @@ -102,6 +102,15 @@ util_dynarray_resize(struct util_dynarray *buf,
> unsigned newsize)
> >     return p;
> >  }
> >
> > +static inline void
> > +util_dynarray_clone(struct util_dynarray *buf, struct util_dynarray
> *mem_ctx,
>
> I think we should keep the mem_ctx a void *.
> Apart from that this patch is:
>

Yes, please.  With that fixed,

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>


> Reviewed-by: Thomas Helland <thomashelland90 at gmail.com>
>
> > +                    struct util_dynarray *from_buf)
> > +{
> > +   util_dynarray_init(buf, mem_ctx);
> > +   util_dynarray_resize(buf, from_buf->size);
> > +   memcpy(buf->data, from_buf->data, from_buf->size);
> > +}
> > +
> >  static inline void *
> >  util_dynarray_grow(struct util_dynarray *buf, int diff)
> >  {
> > --
> > 2.18.0
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180822/835ea0f7/attachment-0001.html>


More information about the mesa-dev mailing list