qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 1/2] QEMUSizedBuffer based QEMUFile


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH v5 1/2] QEMUSizedBuffer based QEMUFile
Date: Wed, 8 Oct 2014 09:23:41 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

* zhanghailiang (address@hidden) 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.

Dave

--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]