summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-10-19 10:44:47 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:50 +0200
commit0760205b668cafea34e110e510a77e0712ba12ff (patch)
treea2a988474bf65dbb3af1de626249abea4607e447 /misc.c
parentc6bc225d5530a82ef9bb6c5ef4b9f4dc791ff485 (diff)
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).
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/misc.c b/misc.c
index d808dbb..eb6ab79 100644
--- a/misc.c
+++ b/misc.c
@@ -37,8 +37,6 @@
# include <fcntl.h>
# include <sys/types.h>
# include <sys/stat.h>
-
- int GC_log; /* Forward decl, so we can set it. */
#endif
#ifdef NONSTOP
@@ -517,6 +515,10 @@ static void maybe_install_looping_handler(void)
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. */
@@ -580,7 +582,7 @@ GC_API void GC_CALL GC_init(void)
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;
}
@@ -991,8 +993,12 @@ out:
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)
@@ -1040,7 +1046,6 @@ STATIC FILE * GC_log = NULL;
#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