qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>
Cc: joel.schopp@amd.com, quintela@redhat.com,
	stefanb@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	arei.gonglei@huawei.com, sanidhya.iiith@gmail.com
Subject: Re: [Qemu-devel] [PATCH v5 1/2] QEMUSizedBuffer based QEMUFile
Date: Wed, 8 Oct 2014 09:23:41 +0100	[thread overview]
Message-ID: <20141008082340.GC2521@work-vm> (raw)
In-Reply-To: <5434A6D7.50209@huawei.com>

* zhanghailiang (zhang.zhanghailiang@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.

Dave

--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2014-10-08  8:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29  9:41 [Qemu-devel] [PATCH v5 0/2] In memory QEMUFile Dr. David Alan Gilbert (git)
2014-09-29  9:41 ` [Qemu-devel] [PATCH v5 1/2] QEMUSizedBuffer based QEMUFile Dr. David Alan Gilbert (git)
2014-10-08  2:52   ` zhanghailiang
2014-10-08  8:23     ` Dr. David Alan Gilbert [this message]
2014-10-08  8:34       ` Markus Armbruster
2014-10-08  9:08     ` Dr. David Alan Gilbert
2014-10-08  9:29       ` zhanghailiang
2014-09-29  9:41 ` [Qemu-devel] [PATCH v5 2/2] Tests: QEMUSizedBuffer/QEMUBuffer Dr. David Alan Gilbert (git)
2014-09-29 14:42 ` [Qemu-devel] [PATCH v5 0/2] In memory QEMUFile Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141008082340.GC2521@work-vm \
    --to=dgilbert@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=joel.schopp@amd.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=sanidhya.iiith@gmail.com \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).