- return;
- if (scm_gc_running_p)
- fprintf (stderr, "%s\n", msg);
- else
- {
- scm_puts (msg, scm_current_error_port ());
- scm_newline (scm_current_error_port ());
- }
- msg = strdup (msg);
- iw = malloc (sizeof (struct issued_warning));
- if (msg == NULL || iw == NULL)
- return;
- iw->message = msg;
- iw->prev = issued_warnings;
- issued_warnings = iw;
+ {
+ msg = NULL;
+ break;
+ }
+ if (msg)
+ {
+ msg = strdup (msg);
+ iw = malloc (sizeof (struct issued_warning));
+ if (msg == NULL || iw == NULL)
+ /* Nothing sensible to do if you can't allocate this small
+ amount of memory. */
+ abort ();
+ iw->message = msg;
+ iw->prev = issued_warnings;
+ issued_warnings = iw;
+ }
+ scm_i_pthread_mutex_unlock (&warn_lock);
+
+ /* All this dance is to avoid printing to a port inside a mutex,
+ which could recurse and deadlock. */
+ if (msg)
+ {
+ if (scm_gc_running_p)
+ fprintf (stderr, "%s\n", msg);
+ else
+ {
+ scm_puts_unlocked (msg, scm_current_warning_port ());
+ scm_newline (scm_current_warning_port ());
+ }
+ }