Hi Guys,

Here's a patch for a bug that was uncovered on my machine. Hugs did work
for some time, and then suddenly stopped working (ie, wouldn't Parse
Prelude.hs, and eats up CPU). Basically, lineBuffer in input.c was
declared type (char), and EOF on my machine is -1, so it's outside the
range of (char). The bug occurs line 516 of input.c (original). It works
ok on x86, so I've put a little preprocessor routine to adapt depending
on the value of EOF. There's one of my comments there, and if you feel
that it taints hugs code, feel free to remove it.

Take care, keep up the good work :).

\LaShI


-- 
Debian GNU/Linux 3.0 (Sid) (ibook2,powerpc), kernel 2.4.18-benh-xfs

<[EMAIL PROTECTED]> 
1874 5597 C754 5209 0A7D  4DA6 9112 5D0E CC1F 67BC
diff -u ../hugs98-Dec2001/src/input.c src/input.c
--- ../hugs98-Dec2001/src/input.c	2002-07-15 03:21:03.000000000 +1000
+++ src/input.c	2002-07-29 17:47:18.000000000 +1000
@@ -309,11 +309,22 @@
     return isIn(c,LARGE);
 }
 
+/* BUGFIX: Menaka Lashitha Bandara <[EMAIL PROTECTED]>
+ * 	   <[EMAIL PROTECTED]> -- doesn't work at the moment, but preffered.
+ * (char) *lineBuffer causes a comparison lineBuffer [lineLength] == EOF to
+ * always be false, thereby not being able to Parse files on some machines. */
+
+#if EOF < 0
+#define LINE_BUFFER_SIZE_TYPE	signed char
+#else
+#define LINE_BUFFER_SIZE_TYPE 	char
+#endif
+
 #if HAVE_GETDELIM_H
-static char *lineBuffer = NULL;   /* getline() does the initial allocation */
+static LINE_BUFFER_SIZE_TYPE *lineBuffer = NULL;   /* getline() does the initial allocation */
 #else
 #define LINEBUFFER_SIZE 1000
-static char lineBuffer[LINEBUFFER_SIZE];
+static LINE_BUFFER_SIZE_TYPE lineBuffer[LINEBUFFER_SIZE];
 #endif
 static int lineLength = 0;
 static int inCodeBlock = FALSE; /* Inside \begin{code}..\end{code} */

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to