hotspot/src/share/vm/oops/symbol.cpp
changeset 13391 30245956af37
parent 13195 be27e1b6a4b9
child 13728 882756847a04
equal deleted inserted replaced
13309:50c604cb0d5f 13391:30245956af37
    94   address bytes = (address) ((Symbol*)this)->base();
    94   address bytes = (address) ((Symbol*)this)->base();
    95   address limit = bytes + utf8_length() - len;  // inclusive limit
    95   address limit = bytes + utf8_length() - len;  // inclusive limit
    96   address scan = bytes + i;
    96   address scan = bytes + i;
    97   if (scan > limit)
    97   if (scan > limit)
    98     return -1;
    98     return -1;
    99   for (;;) {
    99   for (; scan <= limit; scan++) {
   100     scan = (address) memchr(scan, first_char, (limit + 1 - scan));
   100     scan = (address) memchr(scan, first_char, (limit + 1 - scan));
   101     if (scan == NULL)
   101     if (scan == NULL)
   102       return -1;  // not found
   102       return -1;  // not found
   103     assert(scan >= bytes+i && scan <= limit, "scan oob");
   103     assert(scan >= bytes+i && scan <= limit, "scan oob");
   104     if (memcmp(scan, str, len) == 0)
   104     if (memcmp(scan, str, len) == 0)
   105       return (int)(scan - bytes);
   105       return (int)(scan - bytes);
   106   }
   106   }
       
   107   return -1;
   107 }
   108 }
   108 
   109 
   109 
   110 
   110 char* Symbol::as_C_string(char* buf, int size) const {
   111 char* Symbol::as_C_string(char* buf, int size) const {
   111   if (size > 0) {
   112   if (size > 0) {