From 6381ab9d29964508882d15026f5be00726da5acb Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 20 Nov 2024 14:48:52 +0100 Subject: [PATCH] hardcode state file name --- src/x50ng/module.c | 8 ++++++-- src/x50ng/options.c | 2 -- src/x50ng/options.h | 1 - src/x50ng/x49gp.h | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/x50ng/module.c b/src/x50ng/module.c index f3b2f9a..68bc62d 100644 --- a/src/x50ng/module.c +++ b/src/x50ng/module.c @@ -10,6 +10,8 @@ #include "x49gp.h" #include "options.h" +#define STATE_FILE_NAME "state" + int x49gp_modules_init( x49gp_t* x49gp ) { x49gp_module_t* module; @@ -85,11 +87,12 @@ int x49gp_modules_reset( x49gp_t* x49gp, x49gp_reset_t reset ) return 0; } -int x49gp_modules_load( x49gp_t* x49gp, const char* filename ) +int x49gp_modules_load( x49gp_t* x49gp ) { x49gp_module_t* module; GError* gerror = NULL; int error, result; + const char* filename = g_build_filename( opt.datadir, STATE_FILE_NAME, NULL ); #ifdef DEBUG_X49GP_MODULES printf( "%s:%u:\n", __FUNCTION__, __LINE__ ); @@ -140,7 +143,7 @@ int x49gp_modules_load( x49gp_t* x49gp, const char* filename ) return result; } -int x49gp_modules_save( x49gp_t* x49gp, const char* filename ) +int x49gp_modules_save( x49gp_t* x49gp ) { x49gp_module_t* module; GError* gerror = NULL; @@ -148,6 +151,7 @@ int x49gp_modules_save( x49gp_t* x49gp, const char* filename ) gsize length; int error; int fd; + const char* filename = g_build_filename( opt.datadir, STATE_FILE_NAME, NULL ); #ifdef DEBUG_X49GP_MODULES printf( "%s:%u:\n", __FUNCTION__, __LINE__ ); diff --git a/src/x50ng/options.c b/src/x50ng/options.c index 6da251c..8547601 100644 --- a/src/x50ng/options.c +++ b/src/x50ng/options.c @@ -249,8 +249,6 @@ void config_init( char* progname, int argc, char* argv[] ) const char* config_lua_filename = g_build_filename( opt.datadir, "config.lua", NULL ); - opt.state_filename = g_build_filename( opt.datadir, "state", NULL ); - /**********************/ /* 1. read config.lua */ /**********************/ diff --git a/src/x50ng/options.h b/src/x50ng/options.h index 0b3b0b3..bb36995 100644 --- a/src/x50ng/options.h +++ b/src/x50ng/options.h @@ -18,7 +18,6 @@ typedef enum { MODEL_49GP = 0, MODEL_50G } x50ng_model_t; struct options { - char* state_filename; int debug_port; int start_debugger; char* firmware; diff --git a/src/x50ng/x49gp.h b/src/x50ng/x49gp.h index 52b0223..237d0f2 100644 --- a/src/x50ng/x49gp.h +++ b/src/x50ng/x49gp.h @@ -118,8 +118,8 @@ extern int s3c2410_sdi_is_mounted( x49gp_t* x49gp ); extern int x49gp_modules_init( x49gp_t* ); extern int x49gp_modules_exit( x49gp_t* ); extern int x49gp_modules_reset( x49gp_t*, x49gp_reset_t ); -extern int x49gp_modules_load( x49gp_t*, const char* ); -extern int x49gp_modules_save( x49gp_t*, const char* ); +extern int x49gp_modules_load( x49gp_t* ); +extern int x49gp_modules_save( x49gp_t* ); extern int x49gp_flash_init( x49gp_t* ); extern int x49gp_sram_init( x49gp_t* );