[haiku-commits] Re: haiku: hrev46868 - src/kits/network/libnetapi

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 13 Feb 2014 12:14:19 +0100

On 13.02.2014 12:00, Axel Dörfler wrote:
On February 13, 2014 at 10:22 AM superstippi@xxxxxx wrote:
+                     if (cookieString.Length() > 0)
+                             cookieString << "; ";

Not that it matters much, but there is a BString::IsEmpty() method for this
purpose (which makes for easier to read code).

Maybe it's my training to avoid the Java String.isEmpty() method which is not available in Java 1.5... :-) I wasn't completely satisfied with my solution there. I think the loop should be re-phrased instead, so that the next cookie is retrieved at the end of the loop and if it's non-NULL, the semicolon is appended, otherwise the loop is exited. This should give the performance of the previous implementation while still avoiding the Truncate() call. (I am aware that BString::Length() is independent of the string length...)

Best regards,
-Stephan


Other related posts: