medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e0a95477849f8e742efe900b3dd7d8801da6d6a6
parent ab32009233b2d86f56319ace091a8a8f5b174a01
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Wed Sep 14 15:46:48 +0100

Rename ERROR to FATAL

Diffstat:
gl.cc | 6+++---
glsl.cc | 4++--
linux_audio.h | 10+++++-----
log.cc | 2+-
log.h | 4++--
main.cc | 2+-
win32_semaphore.h | 12+++---------
7 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/gl.cc b/gl.cc @@ -75,7 +75,7 @@ GLFWwindow * gl_init() { glfwSetErrorCallback( glfw_error_printer ); if( !glfwInit() ) { - ERROR( "glfwInit" ); + FATAL( "glfwInit" ); } glfwWindowHint( GLFW_RESIZABLE, 0 ); @@ -88,13 +88,13 @@ GLFWwindow * gl_init() { GLFWwindow * const window = glfwCreateWindow( WIDTH, HEIGHT, "bsp", NULL, NULL ); if( !window ) { - ERROR( "glfwCreateWindow" ); + FATAL( "glfwCreateWindow" ); } glfwMakeContextCurrent( window ); if( gladLoadGL() != 1 ) { - ERROR( "gladLoadGL" ); + FATAL( "gladLoadGL" ); } if( GLAD_GL_KHR_debug ) { diff --git a/glsl.cc b/glsl.cc @@ -17,7 +17,7 @@ void check_compile_status( GLuint shader ) { char * buf = ( char * ) malloc( len ); if( buf == NULL ) { - ERROR( "malloc" ); + FATAL( "malloc" ); } glGetShaderInfoLog( shader, len, NULL, buf ); @@ -38,7 +38,7 @@ void check_link_status( GLuint program ) { char * buf = ( char * ) malloc( len ); if( buf == NULL ) { - ERROR( "malloc" ); + FATAL( "malloc" ); } glGetProgramInfoLog( program, len, NULL, buf ); diff --git a/linux_audio.h b/linux_audio.h @@ -47,7 +47,7 @@ void audio_output_open( AudioOutputDevice * device ) { if( !audio_inited ) { void * alsa_lib = dlopen( "libasound.so", RTLD_NOW ); if( alsa_lib == NULL ) { - ERROR( "Couldn't open libasound.so: %s", dlerror() ); + FATAL( "Couldn't open libasound.so: %s", dlerror() ); } _snd_lib_error_set_handler = ( int ( * )( snd_lib_error_handler_t ) ) dlsym( alsa_lib, "snd_lib_error_set_handler" ); @@ -67,7 +67,7 @@ void audio_output_open( AudioOutputDevice * device ) { || _snd_pcm_recover == NULL || _snd_pcm_close == NULL ) { - ERROR( "Couldn't load ALSA functions" ); + FATAL( "Couldn't load ALSA functions" ); } _snd_lib_error_set_handler( audio_error_handler ); @@ -83,7 +83,7 @@ void audio_output_open( AudioOutputDevice * device ) { int err_open = _snd_pcm_open( &device->pcm, "default", SND_PCM_STREAM_PLAYBACK, 0 ); if( err_open != 0 ) { // TODO: maybe don't kill the program - ERROR( "Couldn't open sound output: %s", _snd_strerror( err_open ) ); + FATAL( "Couldn't open sound output: %s", _snd_strerror( err_open ) ); } int err_params = _snd_pcm_set_params( device->pcm, @@ -91,7 +91,7 @@ void audio_output_open( AudioOutputDevice * device ) { channels, sample_rate, 1, latency ); if( err_params != 0 ) { // TODO: maybe don't kill the program - ERROR( "Couldn't configure sound output: %s", _snd_strerror( err_params ) ); + FATAL( "Couldn't configure sound output: %s", _snd_strerror( err_params ) ); } } @@ -99,7 +99,7 @@ void audio_output_close( AudioOutputDevice * device ) { int err = _snd_pcm_close( device->pcm ); if( err != 0 ) { // TODO: maybe don't kill the program - ERROR( "Couldn't close sound output: %s", _snd_strerror( err ) ); + FATAL( "Couldn't close sound output: %s", _snd_strerror( err ) ); } } diff --git a/log.cc b/log.cc @@ -9,7 +9,7 @@ static bool initialised = false; static FILE * streams[ LOGLEVEL_COUNT + 1 ]; static const char * names[ LOGLEVEL_COUNT + 1 ] = { - "errors", + "fatals", "warnings", "info", "all", diff --git a/log.h b/log.h @@ -6,7 +6,7 @@ #include "platform_thread.h" enum LogLevel { - LOGLEVEL_ERROR, + LOGLEVEL_FATAL, LOGLEVEL_WARNING, LOGLEVEL_INFO, @@ -17,6 +17,6 @@ void log_generic( LogLevel level, const char * fmt, ... ); #define INFO( form, ... ) log_generic( LOGLEVEL_INFO, "[INFO] [thread %u] " form "\n", thread_getid(), ##__VA_ARGS__ ) #define WARN( form, ... ) log_generic( LOGLEVEL_WARNING, "[WARN] [thread %u] " form "\n", thread_getid(), ##__VA_ARGS__ ) -#define ERROR( form, ... ) do { log_generic( LOGLEVEL_ERROR, "[ERROR] [thread %u] " form "\n", thread_getid(), ##__VA_ARGS__ ); exit( 1 ); } while( 0 ) +#define FATAL( form, ... ) do { log_generic( LOGLEVEL_FATAL, "[FATAL] [thread %u] " form "\n", thread_getid(), ##__VA_ARGS__ ); exit( 1 ); } while( 0 ) #endif // _LOG_H_ diff --git a/main.cc b/main.cc @@ -78,7 +78,7 @@ int main( int argc, char ** argv ) { size_t persistent_size = megabytes( 64 ); u8 * persistent_memory = ( u8 * ) malloc( persistent_size ); if( persistent_memory == NULL ) { - ERROR( "couldn't allocate persistent memory" ); + FATAL( "couldn't allocate persistent memory" ); } GameMemory mem = { }; diff --git a/win32_semaphore.h b/win32_semaphore.h @@ -11,25 +11,19 @@ inline void semaphore_init( Semaphore * sem ) { LONG max = 1024; // TODO sem->sem = CreateSemaphore( NULL, 0, max, NULL ); if( sem->sem == NULL ) { - // ERROR( "CreateSemaphore failed" ); - printf( "CreateSemaphore failed" ); - exit( 1 ); + FATAL( "CreateSemaphore failed" ); } } inline void semaphore_signal( Semaphore * sem ) { if( ReleaseSemaphore( sem->sem, 1, NULL ) == 0 ) { - // ERROR( "ReleaseSemaphore failed" ); - printf( "ReleaseSemaphore failed" ); - exit( 1 ); + FATAL( "ReleaseSemaphore failed" ); } } inline void semaphore_wait( Semaphore * sem ) { if( WaitForSingleObject( sem->sem, INFINITE ) == WAIT_FAILED ) { - // ERROR( "WaitForSingleObject failed" ); - printf( "WaitForSingleObject failed" ); - exit( 1 ); + FATAL( "WaitForSingleObject failed" ); } }