Nir Soffer
2021-Nov-05 21:24 UTC
[Libguestfs] [PATCH libnbd] common/utils/vector.h: Remove stale reference to `size`
Update stale comments to use `len` instead of `size`.
Fixes: commit cc0567e9aed7e6b40a44bf8eac0a262ac7314fec
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
common/utils/vector.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/common/utils/vector.h b/common/utils/vector.h
index 9ac0867..d828285 100644
--- a/common/utils/vector.h
+++ b/common/utils/vector.h
@@ -59,14 +59,14 @@
*
* string_vector names = empty_vector;
*
- * where ?names.ptr[]? will be an array of strings and ?names.size?
+ * where ?names.ptr[]? will be an array of strings and ?names.len?
* will be the number of strings. There are no get/set accessors. To
* iterate over the strings you can use the ?.ptr? field directly:
*
- * for (size_t i = 0; i < names.size; ++i)
+ * for (size_t i = 0; i < names.len; ++i)
* printf ("%s\n", names.ptr[i]);
*
- * Initializing with ?empty_vector? sets ?.ptr = NULL? and ?.size = 0?.
+ * Initializing with ?empty_vector? sets ?.ptr = NULL? and ?.len = 0?.
*
* DEFINE_VECTOR_TYPE also defines utility functions. For the full
* list see the definition below, but useful functions include:
@@ -91,8 +91,8 @@
typedef struct name name; \
\
/* Reserve n elements at the end of the vector. Note space is \
- * allocated but the vector size is not increased and the new \
- * elements are not initialized. \
+ * allocated and capacity is increased, but the vector length is \
+ * not increased and the new elements are not initialized. \
*/ \
static inline int \
name##_reserve (name *v, size_t n) \
--
2.31.1
Richard W.M. Jones
2021-Nov-05 21:49 UTC
[Libguestfs] [PATCH libnbd] common/utils/vector.h: Remove stale reference to `size`
On Fri, Nov 05, 2021 at 11:24:03PM +0200, Nir Soffer wrote:> Update stale comments to use `len` instead of `size`. > > Fixes: commit cc0567e9aed7e6b40a44bf8eac0a262ac7314fec > Signed-off-by: Nir Soffer <nsoffer at redhat.com> > --- > common/utils/vector.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/common/utils/vector.h b/common/utils/vector.h > index 9ac0867..d828285 100644 > --- a/common/utils/vector.h > +++ b/common/utils/vector.h > @@ -59,14 +59,14 @@ > * > * string_vector names = empty_vector; > * > - * where ?names.ptr[]? will be an array of strings and ?names.size? > + * where ?names.ptr[]? will be an array of strings and ?names.len? > * will be the number of strings. There are no get/set accessors. To > * iterate over the strings you can use the ?.ptr? field directly: > * > - * for (size_t i = 0; i < names.size; ++i) > + * for (size_t i = 0; i < names.len; ++i) > * printf ("%s\n", names.ptr[i]); > * > - * Initializing with ?empty_vector? sets ?.ptr = NULL? and ?.size = 0?. > + * Initializing with ?empty_vector? sets ?.ptr = NULL? and ?.len = 0?. > * > * DEFINE_VECTOR_TYPE also defines utility functions. For the full > * list see the definition below, but useful functions include: > @@ -91,8 +91,8 @@ > typedef struct name name; \ > \ > /* Reserve n elements at the end of the vector. Note space is \ > - * allocated but the vector size is not increased and the new \ > - * elements are not initialized. \ > + * allocated and capacity is increased, but the vector length is \ > + * not increased and the new elements are not initialized. \ > */ \ > static inline int \ > name##_reserve (name *v, size_t n) \ACK, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v