Skip to content
Snippets Groups Projects
Commit f2c89178 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Lower severity of repeated errors in js_ReportError()

This needed a custom solution (not errprintf) since the filename is passed-in
is likely from dynamically allocated memory, so a pointer comparison isn't
enough - and we don't get the function name.
parent d9e5dc8b
No related branches found
No related tags found
No related merge requests found
Pipeline #7376 passed
......@@ -5402,7 +5402,22 @@ js_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
warning="warning";
log_level=LOG_WARNING;
} else {
log_level=LOG_ERR;
static pthread_mutex_t mutex;
static bool mutex_initialized;
static char lastfile[MAX_PATH + 1];
static uint lastline;
if(!mutex_initialized) {
pthread_mutex_init(&mutex,NULL);
mutex_initialized = true;
}
pthread_mutex_lock(&mutex);
if(lastline == report->lineno && report->filename != NULL && strcmp(lastfile, report->filename) == 0)
log_level = LOG_WARNING;
else
log_level = LOG_ERR;
lastline = report->lineno;
SAFECOPY(lastfile, report->filename);
pthread_mutex_unlock(&mutex);
warning="";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment