Mercurial > hg > truffle
comparison src/share/vm/utilities/utf8.cpp @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | f95d63e2154a |
children | 1d1603768966 |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 // Returns NULL if 'c' it not found. This only works as long | 165 // Returns NULL if 'c' it not found. This only works as long |
166 // as 'c' is an ASCII character | 166 // as 'c' is an ASCII character |
167 jbyte* UTF8::strrchr(jbyte* base, int length, jbyte c) { | 167 const jbyte* UTF8::strrchr(const jbyte* base, int length, jbyte c) { |
168 assert(length >= 0, "sanity check"); | 168 assert(length >= 0, "sanity check"); |
169 assert(c >= 0, "does not work for non-ASCII characters"); | 169 assert(c >= 0, "does not work for non-ASCII characters"); |
170 // Skip backwards in string until 'c' is found or end is reached | 170 // Skip backwards in string until 'c' is found or end is reached |
171 while(--length >= 0 && base[length] != c); | 171 while(--length >= 0 && base[length] != c); |
172 return (length < 0) ? NULL : &base[length]; | 172 return (length < 0) ? NULL : &base[length]; |
173 } | 173 } |
174 | 174 |
175 bool UTF8::equal(jbyte* base1, int length1, jbyte* base2, int length2) { | 175 bool UTF8::equal(const jbyte* base1, int length1, const jbyte* base2, int length2) { |
176 // Length must be the same | 176 // Length must be the same |
177 if (length1 != length2) return false; | 177 if (length1 != length2) return false; |
178 for (int i = 0; i < length1; i++) { | 178 for (int i = 0; i < length1; i++) { |
179 if (base1[i] != base2[i]) return false; | 179 if (base1[i] != base2[i]) return false; |
180 } | 180 } |