From c9648856c0584bede2d9a4b9cc92d49dcb464326 Mon Sep 17 00:00:00 2001 From: Robert Sayre Date: Tue, 4 Aug 2009 10:30:26 -0700 Subject: [PATCH] Bug 507526 - use getc_unlocked in the scanner rather than getc. r=jorendorff --- js/src/jsscan.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/src/jsscan.cpp b/js/src/jsscan.cpp index 90f3547671d4..2f0842edbd5b 100644 --- a/js/src/jsscan.cpp +++ b/js/src/jsscan.cpp @@ -261,6 +261,14 @@ js_CloseTokenStream(JSContext *cx, JSTokenStream *ts) cx->free((void *) ts->filename); } +#ifdef XP_WIN +#ifdef WINCE +#define getc_unlocked getc +#else +#define getc_unlocked _getc_nolock +#endif +#endif + JS_FRIEND_API(int) js_fgets(char *buf, int size, FILE *file) { @@ -272,7 +280,7 @@ js_fgets(char *buf, int size, FILE *file) return -1; crflag = JS_FALSE; - for (i = 0; i < n && (c = getc(file)) != EOF; i++) { + for (i = 0; i < n && (c = getc_unlocked(file)) != EOF; i++) { buf[i] = c; if (c == '\n') { /* any \n ends a line */ i++; /* keep the \n; we know there is room for \0 */