Differences From:
File
src/blob.c
part of check-in
[054dd31b71]
- Use our own isspace() function since the standard-library isspace()
sometimes gives incorrect results for non-ASCII characters.
by
drh on
2008-11-03 21:56:09.
[view]
To:
File
src/blob.c
part of check-in
[7a2c37063a]
- merge trunk into creole branch
by
bob on
2009-09-22 07:49:39.
Also file
src/blob.c
part of check-in
[4c37130fde]
- Various small performance enhancements.
by
drh on
2009-08-27 18:33:43.
[view]
@@ -80,10 +80,25 @@
** We find that the built-in isspace() function does not work for
** some international character sets. So here is a substitute.
*/
static int blob_isspace(char c){
- return c==' ' || c=='\n' || c=='\t' ||
- c=='\r' || c=='\f' || c=='\v';
+ return c==' ' || (c<='\r' && c>='\t');
+}
+
+/*
+** COMMAND: test-isspace
+*/
+void isspace_cmd(void){
+ int i;
+ for(i=0; i<=255; i++){
+ if( i==' ' || i=='\n' || i=='\t' || i=='\v'
+ || i=='\f' || i=='\r' ){
+ assert( blob_isspace((char)i) );
+ }else{
+ assert( !blob_isspace((char)i) );
+ }
+ }
+ printf("All 256 characters OK\n");
}
/*
** This routine is called if a blob operation fails because we