"Dr. David Alan Gilbert" <dgilb...@redhat.com> writes:

> * zhanghailiang (zhang.zhanghaili...@huawei.com) wrote:
>> On 2014/9/29 17:41, Dr. David Alan Gilbert (git) wrote:
>
>> >+static ssize_t qsb_grow(QEMUSizedBuffer *qsb, size_t new_size)
>> >+{
>> >+    size_t needed_chunks, i;
>> >+
>> >+    if (qsb->size < new_size) {
>> >+        struct iovec *new_iov;
>> >+        size_t size_diff = new_size - qsb->size;
>> >+        size_t chunk_size = (size_diff > QSB_MAX_CHUNK_SIZE)
>> >+                             ? QSB_MAX_CHUNK_SIZE : QSB_CHUNK_SIZE;
>> >+
>> >+        needed_chunks = DIV_ROUND_UP(size_diff, chunk_size);
>> >+
>> >+        new_iov = g_try_malloc_n(qsb->n_iov + needed_chunks,
>> >+                                 sizeof(struct iovec));
>> 
>> It seems that *g_try_malloc_n* was supported since glib2-2.24 version,
>> But it don't check this when do *configure* before compile...;)
>
> OK, that's a shame - it was a nice easy function to use :-)
> I'll fix it.

See also commit 02c4f26.

Reply via email to