equal
deleted
inserted
replaced
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) { |