diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-02-26 16:16:46 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-02-26 16:16:46 -0600 |
commit | 988fed59511d99541ec2be87127456105a1a4e2c (patch) | |
tree | 1114c07849475021d05b5ad525db155f7f55c47b | |
parent | c6f4d051b2bb2ff31590305c7f1e79d9c310abd0 (diff) | |
download | ofono-988fed59511d99541ec2be87127456105a1a4e2c.tar.bz2 |
Fix: Don't allocate buffers if we don't need to
-rw-r--r-- | gatchat/gatserver.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c index 5b5e2f74..05392e9a 100644 --- a/gatchat/gatserver.c +++ b/gatchat/gatserver.c @@ -136,7 +136,12 @@ static void send_common(GAtServer *server, const char *buf, unsigned int len) buf + bytes_written, wbytes); - if (ring_buffer_avail(write_buf) == 0) + /* + * Make sure we don't allocate a buffer if we've written + * everything out already + */ + if (ring_buffer_avail(write_buf) == 0 && + bytes_written < towrite) write_buf = allocate_next(server); } |