costin 01/05/27 16:16:20
Modified: src/share/org/apache/tomcat/util/buf ByteChunk.java
src/share/org/apache/tomcat/util/http Parameters.java
Log:
Removed the debug from Parameters.
Added the indexOf() method in ByteChunk - it'll save the other 5-6 strings
we allocated per request. ( the code is not in use right now ). We're
close to zero allocations per "simple" request ( and soon parameter processing
will also be very close to zero ).
Revision Changes Path
1.4 +20 -1
jakarta-tomcat/src/share/org/apache/tomcat/util/buf/ByteChunk.java
Index: ByteChunk.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/buf/ByteChunk.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ByteChunk.java 2001/05/26 17:17:01 1.3
+++ ByteChunk.java 2001/05/27 23:16:19 1.4
@@ -560,6 +560,25 @@
}
return true;
}
+
+ public int indexOf( String src, int srcOff, int srcLen, int myOff ) {
+ char first=src.charAt( srcOff );
+
+ // Look for first char
+ int srcEnd=srcOff + srcLen;
+
+ for( int i=myOff; i< end - srcLen ; i++ ) {
+ if( buff[i] != first ) continue;
+ // found first char, now look for a match
+ int myPos=i+1;
+ for( int srcPos=srcOff; srcPos< srcEnd; ) {
+ if( buff[myPos++] != src.charAt( srcPos++ ))
+ break;
+ if( srcPos==srcEnd ) return i; // found it
+ }
+ }
+ return -1;
+ }
// -------------------- Hash code --------------------
@@ -615,7 +634,7 @@
return -1;
}
- /** Find a character, no side effects.
+ /** Find a character, no side effects.
* @returns index of char if found, -1 if not
*/
public static int findChar( byte buf[], int start, int end, char c ) {
1.13 +1 -1
jakarta-tomcat/src/share/org/apache/tomcat/util/http/Parameters.java
Index: Parameters.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/http/Parameters.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Parameters.java 2001/05/26 17:24:17 1.12
+++ Parameters.java 2001/05/27 23:16:19 1.13
@@ -480,7 +480,7 @@
return sb.toString();
}
- private static int debug=1;
+ private static int debug=0;
private void log(String s ) {
System.out.println("Parameters: " + s );
}