--- a/String.st Sat Jul 09 00:52:55 2005 +0200
+++ b/String.st Sat Jul 09 00:57:11 2005 +0200
@@ -950,35 +950,35 @@
OBJ cls;
if (__isSmallInteger(start)) {
- if (__isCharacter(aCharacter)) {
- byteValue = __intVal(_characterVal(aCharacter));
- if (byteValue <= 0xFF) {
- index = __intVal(start);
- if (index <= 0)
- index = 1;
- last = __stringSize(self);
- cp = __stringVal(self);
- if ((cls = __qClass(self)) != String) {
- int numInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-
- cp += numInstBytes;
- last += numInstBytes;
- }
- if (index <= last) {
+ index = __intVal(start);
+ if (index > 0) {
+ if (__isCharacter(aCharacter)) {
+ byteValue = __intVal(_characterVal(aCharacter));
+ if (byteValue <= 0xFF) {
+ last = __stringSize(self);
+ cp = __stringVal(self);
+ if ((cls = __qClass(self)) != String) {
+ int numInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+
+ cp += numInstBytes;
+ last += numInstBytes;
+ }
+ if (index <= last) {
#ifdef FAST_MEMCHR
- ncp = (unsigned char *) memchr(cp+index-1, byteValue, last+1-index);
- if (ncp) {
- RETURN ( __mkSmallInteger(ncp - cp + 1) );
- }
+ ncp = (unsigned char *) memchr(cp+index-1, byteValue, last+1-index);
+ if (ncp) {
+ RETURN ( __mkSmallInteger(ncp - cp + 1) );
+ }
#else
- for (; index <= last; index++) {
- if (*cp++ == byteValue) { RETURN ( __mkSmallInteger(index) ); }
- }
+ for (; index <= last; index++) {
+ if (*cp++ == byteValue) { RETURN ( __mkSmallInteger(index) ); }
+ }
#endif
- }
+ }
+ }
}
- }
- RETURN ( __mkSmallInteger(0) );
+ RETURN ( __mkSmallInteger(0) );
+ }
}
%}.
^ super indexOf:aCharacter startingAt:start
@@ -3422,5 +3422,5 @@
!String class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.226 2005-07-08 22:52:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.227 2005-07-08 22:57:11 cg Exp $'
! !