src/hotspot/share/oops/symbol.cpp
changeset 51997 9ce37fa2e179
parent 51405 8b23aa7cef47
child 52014 1aa9beac610e
equal deleted inserted replaced
51996:84743156e780 51997:9ce37fa2e179
    77 // Tests if the symbol starts with the specified prefix of the given
    77 // Tests if the symbol starts with the specified prefix of the given
    78 // length.
    78 // length.
    79 bool Symbol::starts_with(const char* prefix, int len) const {
    79 bool Symbol::starts_with(const char* prefix, int len) const {
    80   if (len > utf8_length()) return false;
    80   if (len > utf8_length()) return false;
    81   while (len-- > 0) {
    81   while (len-- > 0) {
    82     if (prefix[len] != (char) byte_at(len))
    82     if (prefix[len] != char_at(len))
    83       return false;
    83       return false;
    84   }
    84   }
    85   assert(len == -1, "we should be at the beginning");
    85   assert(len == -1, "we should be at the beginning");
    86   return true;
    86   return true;
    87 }
    87 }
   115 
   115 
   116 char* Symbol::as_C_string(char* buf, int size) const {
   116 char* Symbol::as_C_string(char* buf, int size) const {
   117   if (size > 0) {
   117   if (size > 0) {
   118     int len = MIN2(size - 1, utf8_length());
   118     int len = MIN2(size - 1, utf8_length());
   119     for (int i = 0; i < len; i++) {
   119     for (int i = 0; i < len; i++) {
   120       buf[i] = byte_at(i);
   120       buf[i] = char_at(i);
   121     }
   121     }
   122     buf[len] = '\0';
   122     buf[len] = '\0';
   123   }
   123   }
   124   return buf;
   124   return buf;
   125 }
   125 }
   309   if (this == NULL) {
   309   if (this == NULL) {
   310     st->print("NULL");
   310     st->print("NULL");
   311   } else {
   311   } else {
   312     st->print("'");
   312     st->print("'");
   313     for (int i = 0; i < utf8_length(); i++) {
   313     for (int i = 0; i < utf8_length(); i++) {
   314       st->print("%c", byte_at(i));
   314       st->print("%c", char_at(i));
   315     }
   315     }
   316     st->print("'");
   316     st->print("'");
   317   }
   317   }
   318 }
   318 }
   319 
   319