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

Unified Diff: src/core/SkTSearch.cpp

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: docs and REQUIRE_LOCAL_VAR Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkTSearch.cpp
diff --git a/src/core/SkTSearch.cpp b/src/core/SkTSearch.cpp
index 64c70cb311072f762fda10848be157b8a113c9e4..a96adce6ccd8c22df99a47aa669d35d8d0ced646 100644
--- a/src/core/SkTSearch.cpp
+++ b/src/core/SkTSearch.cpp
@@ -8,7 +8,6 @@
#include "SkTSearch.h"
-#include <ctype.h>
static inline const char* index_into_base(const char*const* base, int index,
size_t elemSize)
@@ -73,42 +72,3 @@ int SkStrLCSearch(const char*const* base, int count, const char target[],
{
return SkStrLCSearch(base, count, target, strlen(target), elemSize);
}
-
-//////////////////////////////////////////////////////////////////////////////
-
-SkAutoAsciiToLC::SkAutoAsciiToLC(const char str[], size_t len)
-{
- // see if we need to compute the length
- if ((long)len < 0) {
- len = strlen(str);
- }
- fLength = len;
-
- // assign lc to our preallocated storage if len is small enough, or allocate
- // it on the heap
- char* lc;
- if (len <= STORAGE) {
- lc = fStorage;
- } else {
- lc = (char*)sk_malloc_throw(len + 1);
- }
- fLC = lc;
-
- // convert any asii to lower-case. we let non-ascii (utf8) chars pass
- // through unchanged
- for (int i = (int)(len - 1); i >= 0; --i) {
- int c = str[i];
- if ((c & 0x80) == 0) { // is just ascii
- c = tolower(c);
- }
- lc[i] = c;
- }
- lc[len] = 0;
-}
-
-SkAutoAsciiToLC::~SkAutoAsciiToLC()
-{
- if (fLC != fStorage) {
- sk_free(fLC);
- }
-}
« src/core/SkDraw.cpp ('K') | « src/core/SkString.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698