@@ -68,14 +68,14 @@ The \p drvector DynamoRIO Extension provides a simple resizable array (a vector)
6868Initialize a vector with drvector_init():
6969\code
7070drvector_t vec;
71- drvector_init(&vec, 10, true, free_callback);
71+ drvector_init(&vec, /*initial_capacity=*/ 10, /*synch=*/ true, free_callback);
7272\endcode
7373
7474To provide additional configuration parameters, use drvector_init_ex():
7575\code
7676drvector_t vec;
77- drvector_config_t config = {sizeof(config), true};
78- drvector_init_ex(&vec, 10, true, free_callback, &config);
77+ drvector_config_t config = {/*size=*/ sizeof(config), /*zero_alloc=*/ true};
78+ drvector_init_ex(&vec, /*initial_capacity=*/ 10, /*synch=*/ true, free_callback, &config);
7979\endcode
8080
8181The \p initial_capacity can be 0, in which case the internal array is lazily allocated
@@ -102,10 +102,11 @@ field of the \p drvector_t structure for better performance.
102102drvector_set_entry() will automatically resize the vector if the index is beyond
103103the current capacity. It also updates the number of entries to be \p idx + 1 if the
104104index is greater than or equal to the current number of entries. Note that entries in
105- between the last set index and the current index are left uninitialized, hence clearing
106- or deleting a vector that has a \p free_callback set can be problematic, as the
107- \p free_callback function will be called on uninitialized entries. It's the user
108- responsibility to set all entries.
105+ between the last set index and the current index are left uninitialized (unless
106+ #drvector_config_t.zero_alloc is set), hence clearing or deleting a vector that has a
107+ \p free_callback set can be problematic, as the \p free_callback function will be called
108+ on uninitialized entries. It's the user's responsibility to set all entries prior to the
109+ \p free_callback being called.
109110
110111\subsection sec_drcontainers_vector_synch Synchronization
111112
@@ -150,8 +151,8 @@ void free_data(void *ptr) {
150151}
151152
152153drvector_t vec;
153- drvector_config_t config = {sizeof(config), true};
154- drvector_init_ex(&vec, 0, false, free_data, &config);
154+ drvector_config_t config = {/*size=*/ sizeof(config), /*zero_alloc=*/ true};
155+ drvector_init_ex(&vec, /*initial_capacity=*/ 0, /*synch=*/ false, free_data, &config);
155156
156157int *data = dr_global_alloc(sizeof(int));
157158*data = 42;
0 commit comments