Update of /cvsroot/monetdb/MonetDB/src/testing
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11411
Modified Files:
difflib.c helpers.c helpers.h
Log Message:
Check for ASCII-ness before passing on to isspace and friends.
Index: difflib.c
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/testing/difflib.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- difflib.c 31 Oct 2007 10:51:16 -0000 1.49
+++ difflib.c 8 Jan 2008 14:19:38 -0000 1.50
@@ -317,25 +317,25 @@
i = 0;
} while (line[strlen(line) - 1] != '\n'
&& (ok = fgets(line, BUFLEN, lw_diff_fp)));
} else {
- space = isspace((int) (line[1]));
+ space = isspace_((int) (line[1]));
alpha_ = isalpha_((int) (line[1]));
- digit = isdigit((int) (line[1]));
+ digit = isdigit_((int) (line[1]));
i = 1;
do {
for (; line[i] != '\n' &&
line[i] != '\0'; i++) {
- if ((space &&
!isspace((int) line[i])) ||
- (!space &&
isspace((int) line[i])) ||
+ if ((space &&
!isspace_((int) line[i])) ||
+ (!space &&
isspace_((int) line[i])) ||
(alpha_ &&
!isalpha_((int) line[i])) ||
(!alpha_ &&
isalpha_((int) line[i])) ||
- (digit &&
!isdigit((int) line[i])) ||
- (!digit &&
isdigit((int) line[i])) ||
- (!isspace((int)
line[i]) &&
+ (digit &&
!isdigit_((int) line[i])) ||
+ (!digit &&
isdigit_((int) line[i])) ||
+ (!isspace_((int)
line[i]) &&
!isalpha_((int)
line[i]) &&
- !isdigit((int)
line[i]))) {
+ !isdigit_((int)
line[i]))) {
fprintf(fp[j],
"\n");
- space =
isspace((int) line[i]);
+ space =
isspace_((int) line[i]);
alpha_ =
isalpha_((int) line[i]);
- digit =
isdigit((int) line[i]);
+ digit =
isdigit_((int) line[i]);
l[j]++;
}
fprintf(fp[j], "%c",
line[i]);
Index: helpers.h
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/testing/helpers.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- helpers.h 9 Sep 2007 11:39:05 -0000 1.13
+++ helpers.h 8 Jan 2008 14:19:38 -0000 1.14
@@ -28,7 +28,9 @@
FILE *Rfopen(char *name);
FILE *Wfopen(char *name);
FILE *Afopen(char *name);
-int isalpha_(int c);
+#define isalpha_(c) (isascii(c) && (isalpha(c) || c == '_'))
+#define isspace_(c) (isascii(c) && isspace(c))
+#define isdigit_(c) (isascii(c) && isdigit(c))
char *filename(char *path);
char *tmpdir(void);
Index: helpers.c
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/testing/helpers.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- helpers.c 9 Sep 2007 11:39:05 -0000 1.17
+++ helpers.c 8 Jan 2008 14:19:38 -0000 1.18
@@ -81,13 +81,6 @@
/* Afopen */
-int
-isalpha_(int c)
-{
- return (isalpha(c) || (c == '_'));
-}
-
-
char *
filename(char *path)
{
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins