Re: [Mesa-dev] [PATCH 3/3] u_dynarray: turn util_dynarray_{grow, resize} into element-oriented macros

2019-05-13 Thread Haehnle, Nicolai
On 04.05.19 17:55, Gustaw Smolarczyk wrote: > sob., 4 maj 2019 o 15:25 Nicolai Hähnle napisał(a): >> static inline void >> util_dynarray_clone(struct util_dynarray *buf, void *mem_ctx, >> struct util_dynarray *from_buf) >> { >> util_dynarray_init(buf, mem_ctx); >>

Re: [Mesa-dev] [PATCH 3/3] u_dynarray: turn util_dynarray_{grow, resize} into element-oriented macros

2019-05-13 Thread Haehnle, Nicolai
On 05.05.19 01:19, Bas Nieuwenhuizen wrote: >> /* use util_dynarray_trim to reduce the allocated storage */ >> static inline void * >> -util_dynarray_resize(struct util_dynarray *buf, unsigned newsize) >> +util_dynarray_resize_bytes(struct util_dynarray *buf, unsigned nelts, >> size_t

Re: [Mesa-dev] [PATCH 3/3] u_dynarray: turn util_dynarray_{grow, resize} into element-oriented macros

2019-05-04 Thread Bas Nieuwenhuizen
On Sat, May 4, 2019 at 3:25 PM Nicolai Hähnle wrote: > > From: Nicolai Hähnle > > The main motivation for this change is API ergonomics: most operations > on dynarrays are really on elements, not on bytes, so it's weird to have > grow and resize as the odd operations out. > > The secondary

Re: [Mesa-dev] [PATCH 3/3] u_dynarray: turn util_dynarray_{grow, resize} into element-oriented macros

2019-05-04 Thread Gustaw Smolarczyk
sob., 4 maj 2019 o 15:25 Nicolai Hähnle napisał(a): > > From: Nicolai Hähnle > > The main motivation for this change is API ergonomics: most operations > on dynarrays are really on elements, not on bytes, so it's weird to have > grow and resize as the odd operations out. > > The secondary

[Mesa-dev] [PATCH 3/3] u_dynarray: turn util_dynarray_{grow, resize} into element-oriented macros

2019-05-04 Thread Nicolai Hähnle
From: Nicolai Hähnle The main motivation for this change is API ergonomics: most operations on dynarrays are really on elements, not on bytes, so it's weird to have grow and resize as the odd operations out. The secondary motivation is memory safety. Users of the old byte-oriented functions