From 08271cf4c25d3790726f953f970d47acfd04e377 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Thu, 14 Nov 2024 15:25:45 +0100 Subject: [PATCH] fix naming mistake: x49gp->state was never a filename but a loaded ini file --- src/x49gpng/module.c | 14 +++++++------- src/x49gpng/x49gp.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/x49gpng/module.c b/src/x49gpng/module.c index c936c69..77cc855 100644 --- a/src/x49gpng/module.c +++ b/src/x49gpng/module.c @@ -101,16 +101,16 @@ int x49gp_modules_load( x49gp_t* x49gp, const char* filename ) return error; } - x49gp->state_filename = g_key_file_new(); - if ( NULL == x49gp->state_filename ) { + x49gp->state = g_key_file_new(); + if ( NULL == x49gp->state ) { fprintf( stderr, "%s:%u: g_key_file_new: Out of memory\n", __FUNCTION__, __LINE__ ); return -ENOMEM; } - if ( !g_key_file_load_from_file( x49gp->state_filename, filename, G_KEY_FILE_KEEP_COMMENTS, &gerror ) && + if ( !g_key_file_load_from_file( x49gp->state, filename, G_KEY_FILE_KEEP_COMMENTS, &gerror ) && !g_error_matches( gerror, G_FILE_ERROR, G_FILE_ERROR_NOENT ) ) { fprintf( stderr, "%s:%u: g_key_file_load_from_file: %s\n", __FUNCTION__, __LINE__, gerror->message ); - g_key_file_free( x49gp->state_filename ); + g_key_file_free( x49gp->state ); return -EIO; } @@ -118,7 +118,7 @@ int x49gp_modules_load( x49gp_t* x49gp, const char* filename ) list_for_each_entry( module, &x49gp->modules, list ) { - error = module->load( module, x49gp->state_filename ); + error = module->load( module, x49gp->state ); if ( error ) { if ( error == -EAGAIN ) result = -EAGAIN; @@ -155,12 +155,12 @@ int x49gp_modules_save( x49gp_t* x49gp, const char* filename ) list_for_each_entry( module, &x49gp->modules, list ) { - error = module->save( module, x49gp->state_filename ); + error = module->save( module, x49gp->state ); if ( error ) return error; } - data = g_key_file_to_data( x49gp->state_filename, &length, &gerror ); + data = g_key_file_to_data( x49gp->state, &length, &gerror ); if ( NULL == data ) { fprintf( stderr, "%s:%u: g_key_file_to_data: %s\n", __FUNCTION__, __LINE__, gerror->message ); return -ENOMEM; diff --git a/src/x49gpng/x49gp.h b/src/x49gpng/x49gp.h index a1e63d0..52b0223 100644 --- a/src/x49gpng/x49gp.h +++ b/src/x49gpng/x49gp.h @@ -83,7 +83,7 @@ struct __x49gp_s__ { x49gp_ui_t* ui; - GKeyFile* state_filename; + GKeyFile* state; const char* progname; const char* progpath; };