Author: jfarrell
Date: Tue Sep 25 18:58:27 2012
New Revision: 1390051

URL: http://svn.apache.org/viewvc?rev=1390051&view=rev
Log:
THRIFT-1521:patches for more Performance
Client: php
Patch: D. Edler

Removes double function calls in the transport classes to strlen.


Modified:
    thrift/trunk/lib/php/lib/Thrift/Transport/TMemoryBuffer.php

Modified: thrift/trunk/lib/php/lib/Thrift/Transport/TMemoryBuffer.php
URL: 
http://svn.apache.org/viewvc/thrift/trunk/lib/php/lib/Thrift/Transport/TMemoryBuffer.php?rev=1390051&r1=1390050&r2=1390051&view=diff
==============================================================================
--- thrift/trunk/lib/php/lib/Thrift/Transport/TMemoryBuffer.php (original)
+++ thrift/trunk/lib/php/lib/Thrift/Transport/TMemoryBuffer.php Tue Sep 25 
18:58:27 2012
@@ -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;


Reply via email to