Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: Source/wtf/text/StringImpl.h

Issue 213073002: Further WTF::copyChars simplification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Google Inc. All rights reserved. 4 * Copyright (C) 2009 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 --m_refCount; 290 --m_refCount;
291 } 291 }
292 292
293 static StringImpl* empty(); 293 static StringImpl* empty();
294 294
295 // FIXME: Does this really belong in StringImpl? 295 // FIXME: Does this really belong in StringImpl?
296 template <typename T> static void copyChars(T* destination, const T* source, unsigned numCharacters) 296 template <typename T> static void copyChars(T* destination, const T* source, unsigned numCharacters)
297 { 297 {
298 if (numCharacters == 1) {
299 *destination = *source;
300 return;
301 }
302
303 memcpy(destination, source, numCharacters * sizeof(T)); 298 memcpy(destination, source, numCharacters * sizeof(T));
304 } 299 }
305 300
306 ALWAYS_INLINE static void copyChars(UChar* destination, const LChar* source, unsigned numCharacters) 301 ALWAYS_INLINE static void copyChars(UChar* destination, const LChar* source, unsigned numCharacters)
307 { 302 {
308 for (unsigned i = 0; i < numCharacters; ++i) 303 for (unsigned i = 0; i < numCharacters; ++i)
309 destination[i] = source[i]; 304 destination[i] = source[i];
310 } 305 }
311 306
312 // Some string features, like refcounting and the atomicity flag, are not 307 // Some string features, like refcounting and the atomicity flag, are not
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 731 }
737 732
738 using WTF::StringImpl; 733 using WTF::StringImpl;
739 using WTF::equal; 734 using WTF::equal;
740 using WTF::equalNonNull; 735 using WTF::equalNonNull;
741 using WTF::TextCaseSensitivity; 736 using WTF::TextCaseSensitivity;
742 using WTF::TextCaseSensitive; 737 using WTF::TextCaseSensitive;
743 using WTF::TextCaseInsensitive; 738 using WTF::TextCaseInsensitive;
744 739
745 #endif 740 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698