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: Added missing files Created April 6, 2017, 8:08 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/FilterNotifier.cpp ('k') | compiled/bindings.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 bool equals(const String& other) const 107 bool equals(const String& other) const
108 { 108 {
109 if (length() != other.length()) 109 if (length() != other.length())
110 return false; 110 return false;
111 111
112 return std::memcmp(mBuf, other.mBuf, sizeof(value_type) * length()) == 0; 112 return std::memcmp(mBuf, other.mBuf, sizeof(value_type) * length()) == 0;
113 } 113 }
114 114
115 bool operator==(const String& other) const
116 {
117 return equals(other);
118 }
119
120 bool operator!=(const String& other) const
121 {
122 return !equals(other);
123 }
124
115 size_type find(value_type c, size_type pos = 0) const 125 size_type find(value_type c, size_type pos = 0) const
116 { 126 {
117 for (size_type i = pos; i < length(); ++i) 127 for (size_type i = pos; i < length(); ++i)
118 if (mBuf[i] == c) 128 if (mBuf[i] == c)
119 return i; 129 return i;
120 return npos; 130 return npos;
121 } 131 }
122 132
123 size_type find(const String& str, size_type pos = 0) const 133 size_type find(const String& str, size_type pos = 0) const
124 { 134 {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 void append(const String& str) 373 void append(const String& str)
364 { 374 {
365 append(str.mBuf, str.length()); 375 append(str.mBuf, str.length());
366 } 376 }
367 377
368 void append(value_type c) 378 void append(value_type c)
369 { 379 {
370 append(&c, 1); 380 append(&c, 1);
371 } 381 }
372 }; 382 };
OLDNEW
« no previous file with comments | « compiled/FilterNotifier.cpp ('k') | compiled/bindings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld