From 78a54a17f148c17e5c0e9717f2e869066a45130a Mon Sep 17 00:00:00 2001 From: Jake Farrell Date: Tue, 25 Sep 2012 18:58:27 +0000 Subject: [PATCH] THRIFT-1521:patches for more Performance Client: php Patch: D. Edler Removes double function calls in the transport classes to strlen. git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1390051 13f79535-47bb-0310-9956-ffa450edef68 --- lib/php/lib/Thrift/Transport/TMemoryBuffer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/php/lib/Thrift/Transport/TMemoryBuffer.php b/lib/php/lib/Thrift/Transport/TMemoryBuffer.php index cfe5e0ec..911fab64 100644 --- a/lib/php/lib/Thrift/Transport/TMemoryBuffer.php +++ b/lib/php/lib/Thrift/Transport/TMemoryBuffer.php @@ -59,13 +59,15 @@ class TMemoryBuffer extends TTransport { } public function read($len) { - if (TStringFuncFactory::create()->strlen($this->buf_) === 0) { + $bufLength = TStringFuncFactory::create()->strlen($this->buf_); + + if ($bufLength === 0) { throw new TTransportException('TMemoryBuffer: Could not read ' . $len . ' bytes from buffer.', TTransportException::UNKNOWN); } - if (TStringFuncFactory::create()->strlen($this->buf_) <= $len) { + if ($bufLength <= $len) { $ret = $this->buf_; $this->buf_ = ''; return $ret; -- 2.17.1