Changeset 66142 in webkit for trunk/JavaScriptCore/wtf/text/WTFString.cpp
- Timestamp:
- Aug 26, 2010, 3:22:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/text/WTFString.cpp
r65959 r66142 986 986 987 987 #ifndef NDEBUG 988 // For use in the debugger - leaks memory988 // For use in the debugger 989 989 String* string(const char*); 990 Vector<char> asciiDebug(StringImpl* impl); 991 Vector<char> asciiDebug(String& string); 990 992 991 993 String* string(const char* s) 992 994 { 995 // leaks memory! 993 996 return new String(s); 994 997 } 998 999 Vector<char> asciiDebug(StringImpl* impl) 1000 { 1001 if (!impl) 1002 return asciiDebug(String("[null]").impl()); 1003 1004 Vector<char> buffer; 1005 unsigned length = impl->length(); 1006 const UChar* characters = impl->characters(); 1007 1008 buffer.resize(length); 1009 for (unsigned i = 0; i < length; ++i) { 1010 UChar ch = characters[i]; 1011 buffer[i] = ch && (ch < 0x20 || ch > 0x7f) ? '?' : ch; 1012 } 1013 1014 return buffer; 1015 } 1016 1017 Vector<char> asciiDebug(String& string) 1018 { 1019 return asciiDebug(string.impl()); 1020 } 1021 995 1022 #endif
Note:
See TracChangeset
for help on using the changeset viewer.