+2009-10-19 Ivan Maidanski <ivmai@mail.ru>
+
+ * misc.c (GC_log): Remove the declaration; move the definition (to
+ the place where it is used); make STATIC.
+ * misc.c (GC_init): Use GC_err_printf() instead of GC_log_printf()
+ to print open log failure.
+ * misc.c (GC_write): Don't abort on open log failure if the GC is
+ compiled with GC_PRINT_VERBOSE_STATS (useful for WinCE).
+
2009-10-19 Ivan Maidanski <ivmai@mail.ru> (really Andreas Tobler)
* include/private/gcconfig.h (USE_MMAP): Guard with ifndef.
# include <fcntl.h>
# include <sys/types.h>
# include <sys/stat.h>
-
- int GC_log; /* Forward decl, so we can set it. */
#endif
#ifdef NONSTOP
void GC_init_dyld(void);
#endif
+#if !defined(OS2) && !defined(MACOS) && !defined(MSWIN32) && !defined(MSWINCE)
+ STATIC int GC_log = 2;
+#endif
+
GC_API void GC_CALL GC_init(void)
{
/* LOCK(); -- no longer does anything this early. */
if (0 != file_name) {
int log_d = open(file_name, O_CREAT|O_WRONLY|O_APPEND, 0666);
if (log_d < 0) {
- GC_log_printf("Failed to open %s as log file\n", file_name);
+ GC_err_printf("Failed to open %s as log file\n", file_name);
} else {
GC_log = log_d;
}
return -1;
} else if (GC_stdout == 0) {
GC_stdout = GC_CreateLogFile();
- if (GC_stdout == INVALID_HANDLE_VALUE)
+ /* Ignore open log failure if the collector is built with */
+ /* print_stats always set on. */
+# ifndef GC_PRINT_VERBOSE_STATS
+ if (GC_stdout == INVALID_HANDLE_VALUE)
ABORT("Open of log file failed");
+# endif
}
tmp = WriteFile(GC_stdout, buf, (DWORD)len, &written, NULL);
if (!tmp)
#if !defined(OS2) && !defined(MACOS) && !defined(MSWIN32) && !defined(MSWINCE)
STATIC int GC_stdout = 1;
STATIC int GC_stderr = 2;
- int GC_log = 2;
# if !defined(AMIGA)
# include <unistd.h>
# endif