mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 507526 - use getc_unlocked in the scanner rather than getc. r=jorendorff
This commit is contained in:
parent
09801bf00f
commit
c9648856c0
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user