OSDN Git Service

nbd: Less allocation during NBD_OPT_LIST
authorEric Blake <eblake@redhat.com>
Fri, 14 Oct 2016 18:33:13 +0000 (13:33 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 2 Nov 2016 08:28:55 +0000 (09:28 +0100)
commit75368aab9ba27f762acf5a51062c951a1fb1e006
tree535aa0683531863d92bac42cd654b298866a574c
parent7d3123e1775f16bf23fa8d5bac17a3d8a9e72583
nbd: Less allocation during NBD_OPT_LIST

Since we know that the maximum name we are willing to accept
is small enough to stack-allocate, rework the iteration over
NBD_OPT_LIST responses to reuse a stack buffer rather than
allocating every time.  Furthermore, we don't even have to
allocate if we know the server's length doesn't match what
we are searching for.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1476469998-28592-12-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd/client.c