[haiku-commits] Re: haiku: hrev50860 - src/kits/support headers/os/support src/apps/deskcalc src/preferences/keymap src/preferences/mail

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: "haiku-commits@xxxxxxxxxxxxx" <haiku-commits@xxxxxxxxxxxxx>
  • Date: Thu, 12 Jan 2017 16:28:29 +1300

On 12 January 2017 at 08:53,  <pulkomandy@xxxxxxxxxxxxx> wrote:

hrev50860 adds 1 changeset to branch 'master'
old head: 92b9c8649b57a49d1880a9025611797cad7e9bec
new head: 3eac8208dfcd6bd73a534303414784d3754de855
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=3eac8208dfcd+%5E92b9c8649b57

----------------------------------------------------------------------------

3eac8208dfcd: Remove BStringRef and users.

  As discussed in 2008
  (//www.freelists.org/post/haiku-development/BString-on-GCC4,1),
  this class was not efficient because of lack of inlining. Implement the
  suggested solution of a SetCharAt method instead. Also add a CompareAt
  which covers a specific use case in KeyboardLayout.cpp.

  Adjust all places which were using this feature to safer APIs.

  Also fixes a copypaste error in FormattingConventions.cpp.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50860
Commit:      3eac8208dfcd6bd73a534303414784d3754de855
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3eac8208dfcd
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Mon Jan  9 22:12:52 2017 UTC

----------------------------------------------------------------------------

8 files changed, 36 insertions(+), 98 deletions(-)
headers/os/support/String.h               | 31 ++---------
src/apps/deskcalc/ExpressionTextView.cpp  |  8 +--
src/apps/webpositive/BrowserWindow.cpp    |  2 +-
src/kits/locale/FormattingConventions.cpp |  2 +-
src/kits/mail/HaikuMailFormatFilter.cpp   |  2 +-
src/kits/support/String.cpp               | 76 +++++++--------------------
src/preferences/keymap/KeyboardLayout.cpp |  7 ++-
src/preferences/mail/DNSQuery.cpp         |  6 +--

----------------------------------------------------------------------------

diff --git a/headers/os/support/String.h b/headers/os/support/String.h
index 9e33c3c..7471d52 100644
--- a/headers/os/support/String.h
+++ b/headers/os/support/String.h
@@ -183,6 +183,9 @@ public:
                        int                             Compare(const 
BString& string, int32 length) const;
                        int                             Compare(const char* 
string, int32 length) const;

+                       int                             CompareAt(size_t 
offset, const BString& string,
+                                                               int32 length) 
const;
+
                        int                             CompareChars(const 
BString& string,
                                                                int32 
charCount) const;
                        int                             CompareChars(const 
char* string,
@@ -293,9 +296,7 @@ public:
                        // Unchecked char access
                        char                    operator[](int32 index) const;

-#if __GNUC__ > 3
-                       BStringRef              operator[](int32 index);
-#else
+#if __GNUC__ == 2
                        char&                   operator[](int32 index);
 #endif

Is there a reason we're changing public API here for gcc > 2? The
BeBook clearly defines inline char& operator[](int32).

Other related posts: