From 03ef05b08fddd17c989881afa5cfad5c01b61e4e Mon Sep 17 00:00:00 2001 From: Bobby Powers Date: Mon, 10 May 2010 20:33:48 -0700 Subject: [PATCH] libgnumeric: split up gnu_pre_parse_init Isolate the part that is program-argument agnostic into its own function, gnu_pre_init. --- ChangeLog | 6 ++++++ src/libgnumeric.c | 36 ++++++++++++++++++++++++++---------- src/libgnumeric.h | 1 + 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 984b810..ff01c4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-05-10 Bobby Powers + + * src/libgnumeric.c (gnm_pre_parse_init): split out the majority + of the function into gnm_pre_init, which doesn't require argc and + argv. + 2010-05-07 Morten Welinder * configure.in: Post-release bump. diff --git a/src/libgnumeric.c b/src/libgnumeric.c index 7e456d3..83005af 100644 --- a/src/libgnumeric.c +++ b/src/libgnumeric.c @@ -147,14 +147,15 @@ gnm_get_option_group (void) } /** - * gnm_pre_parse_init : - * @gnumeric_binary : argv[0] + * gnm_pre_init : + * @prgname : argv[0] * * Initialization to be done before cmd line arguments are handled. - * Needs to be called first, before any other initialization. + * Needs to be called first, before any other initialization. Usually + * called from gnm_pre_parse_init. **/ -gchar const ** -gnm_pre_parse_init (int argc, gchar const **argv) +void +gnm_pre_init (const char *prgname) { /* * NO CODE BEFORE THIS POINT, PLEASE! @@ -183,11 +184,7 @@ gnm_pre_parse_init (int argc, gchar const **argv) g_thread_init (NULL); g_type_init (); - /* On win32 argv contains 'ansi' encoded args. We need to manually - * pull in the real versions and convert them to utf-8 */ - argv = go_shell_argv_to_glib_encoding (argc, argv); - - g_set_prgname (argv[0]); + g_set_prgname (prgname); /* Make stdout line buffered - we only use it for debug info */ setvbuf (stdout, NULL, _IOLBF, 0); @@ -202,6 +199,25 @@ gnm_pre_parse_init (int argc, gchar const **argv) * Unless we do this they will default to C */ setlocale (LC_ALL, ""); +} + + +/** + * gnm_pre_parse_init : + * @argc : argc + * @argv : argv + * + * Initialization to be done before cmd line arguments are handled. + * Needs to be called first, before any other initialization. + **/ +gchar const ** +gnm_pre_parse_init (int argc, gchar const **argv) +{ + gnm_pre_init (argv[0]); + + /* On win32 argv contains 'ansi' encoded args. We need to manually + * pull in the real versions and convert them to utf-8 */ + argv = go_shell_argv_to_glib_encoding (argc, argv); return argv; } diff --git a/src/libgnumeric.h b/src/libgnumeric.h index 697becb..3f5ef62 100644 --- a/src/libgnumeric.h +++ b/src/libgnumeric.h @@ -18,6 +18,7 @@ G_BEGIN_DECLS # endif #endif /* GNM_VAR_DECL */ +void gnm_pre_init (const char *prgname); char const **gnm_pre_parse_init (int argc, gchar const **argv); void gnm_pre_parse_shutdown (void); void gnm_init (void); -- 1.7.1