X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Futil.c;h=3652d1a308cce86f6646b71a54ad8b35e75d7b78;hb=04b536cbc34449b9abac023e188926bd802fef9f;hp=3898c4a189ac41fffe044b9c652b24a350b8d06f;hpb=c9db7c43812e8bbd7c8e33fe7ee7218a565b7a92;p=bluesky.git diff --git a/bluesky/util.c b/bluesky/util.c index 3898c4a..3652d1a 100644 --- a/bluesky/util.c +++ b/bluesky/util.c @@ -353,6 +353,8 @@ typedef struct { /* To catch attempts to access to invalid profile structures. */ #define PROFILE_MAGIC 0x439929d8 +static FILE *profiling_file = NULL; + BlueSkyProfile *bluesky_profile_new() { BlueSkyProfile *profile = g_new0(BlueSkyProfile, 1); @@ -381,6 +383,9 @@ void bluesky_profile_free(BlueSkyProfile *profile) void bluesky_profile_add_event(BlueSkyProfile *profile, char *message) { + if (profiling_file == NULL) + return; + g_return_if_fail(profile != NULL); if (profile->magic != PROFILE_MAGIC) { @@ -397,7 +402,6 @@ void bluesky_profile_add_event(BlueSkyProfile *profile, char *message) g_mutex_unlock(profile->lock); } -static FILE *profiling_file = NULL; static GStaticMutex profiling_print_lock = G_STATIC_MUTEX_INIT; void bluesky_profile_set_output(FILE *stream) @@ -407,9 +411,9 @@ void bluesky_profile_set_output(FILE *stream) void bluesky_profile_print(BlueSkyProfile *profile) { - if (profiling_file == NULL) - return; FILE *stream = profiling_file; + if (stream == NULL) + return; g_return_if_fail(profile != NULL);