const m_str base = STRING(o);
const size_t sz = strlen(base);
const char pos = *(m_int *)MEM(SZ_INT * 2);
- const M_Object obj = *(M_Object *)MEM(SZ_INT * 2);
- if (sz) {
+ const M_Object obj = *(M_Object *)MEM(SZ_INT);
+ if (sz && pos < sz) {
const m_str arg = STRING(obj);
m_str tmp = base + pos, str = NULL;
while ((tmp = strstr(tmp, arg))) str = tmp++;
<<< "test".find('a') >>>;
<<< "".find('a') >>>;
-<<< "test".find(-1, 'e') >>>;
-<<< "test".find(0, 'e') >>>;
-<<< "test".find(1, 'a') >>>;
-<<< "".find(1, 'a') >>>;
+<<< "test".find('e', -1) >>>;
+<<< "test".find('e', 0) >>>;
+<<< "test".find('a', 1) >>>;
+<<< "".find('a', 0) >>>;
<<< "test".find("es") >>>;
<<< "test".find("a") >>>;
<<< "".find("") >>>;
-<<< "test".find(-1, "es") >>>;
-<<< "test".find(0, "es") >>>;
-<<< "test".find(1, "a") >>>;
-<<< "".find(1, "") >>>;
+<<< "test".find("es", -1) >>>;
+<<< "test".find("es", 0) >>>;
+<<< "test".find("a", 1) >>>;
+<<< "".find("", 1) >>>;
<<< "test".rfind("es") >>>;
<<< "test".rfind("a") >>>;
<<< "".rfind("") >>>;
-<<< "test".rfind(-1, "es") >>>;
-<<< "test".rfind(0, "e") >>>;
-<<< "test".rfind(1, "a") >>>;
-<<< "".rfind(1, "") >>>;
+<<< "test".rfind("es", -1) >>>;
+<<< "test".rfind("e", 0) >>>;
+<<< "test".rfind("a", 1) >>>;
+<<< "".rfind("", 1) >>>;