Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/String.h

Issue 29398669: Issue 5063 - [emscripten] Make FilterNotifier calls more efficient (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Removed newValue and oldValue parameters Created April 15, 2017, 3:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 bool equals(const String& other) const 108 bool equals(const String& other) const
109 { 109 {
110 if (length() != other.length()) 110 if (length() != other.length())
111 return false; 111 return false;
112 112
113 return std::memcmp(mBuf, other.mBuf, sizeof(value_type) * length()) == 0; 113 return std::memcmp(mBuf, other.mBuf, sizeof(value_type) * length()) == 0;
114 } 114 }
115 115
116 bool operator==(const String& other) const
117 {
118 return equals(other);
119 }
120
121 bool operator!=(const String& other) const
122 {
123 return !equals(other);
124 }
125
116 size_type find(value_type c, size_type pos = 0) const 126 size_type find(value_type c, size_type pos = 0) const
117 { 127 {
118 for (size_type i = pos; i < length(); ++i) 128 for (size_type i = pos; i < length(); ++i)
119 if (mBuf[i] == c) 129 if (mBuf[i] == c)
120 return i; 130 return i;
121 return npos; 131 return npos;
122 } 132 }
123 133
124 size_type find(const String& str, size_type pos = 0) const 134 size_type find(const String& str, size_type pos = 0) const
125 { 135 {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 if (negative) 403 if (negative)
394 mBuf[pos++] = '-'; 404 mBuf[pos++] = '-';
395 405
396 for (int i = size - 1; i >= 0; i--) 406 for (int i = size - 1; i >= 0; i--)
397 { 407 {
398 mBuf[pos + i] = '0' + (num % 10); 408 mBuf[pos + i] = '0' + (num % 10);
399 num /= 10; 409 num /= 10;
400 } 410 }
401 } 411 }
402 }; 412 };
OLDNEW

Powered by Google App Engine
This is Rietveld