search for: generic_vector_reserv

Displaying 2 results from an estimated 2 matches for "generic_vector_reserv".

Did you mean: generic_vector_reserve
2020 Oct 27
0
[PATCH libnbd 1/5] common/utils: Copy simple vector library from nbdkit.
...LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> + +#include "vector.h" + +int +generic_vector_reserve (struct generic_vector *v, size_t n, size_t itemsize) +{ + void *newptr; + + newptr = realloc (v->ptr, (n + v->alloc) * itemsize); + if (newptr == NULL) + return -1; + v->ptr = newptr; + v->alloc += n; + return 0; +} diff --git a/common/utils/vector.h b/common/utils/vector.h n...
2020 Oct 27
6
[PATCH libnbd 0/5] info: --map: Coalesce adjacent extents of the same type.
This adds coalescing of adjacent extents of the same type, as mentioned by Eric Blake in the commit message here: https://github.com/libguestfs/libnbd/commit/46072f6611f80245846a445766da071e457b00cd The patch series is rather long because it detours through adding the <vector.h> library from nbdkit into libnbd and replacing ad hoc uses of realloc, char ** etc in various places. Rich.