mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Swap static functions so the lower one can reuse the upper one
This commit is contained in:
parent
3e0d83b256
commit
db6c83cdb6
@ -118,10 +118,43 @@ gfec_catcher(void *data, SCM tag, SCM throw_args)
|
|||||||
void *handler_data : a pointer to pass to the handler
|
void *handler_data : a pointer to pass to the handler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static SCM
|
||||||
|
gfec_string_helper(void *data)
|
||||||
|
{
|
||||||
|
char *string = data;
|
||||||
|
|
||||||
|
return scm_c_eval_string(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
SCM
|
||||||
|
gfec_eval_string(const char *str, gfec_error_handler error_handler)
|
||||||
|
{
|
||||||
|
char *err_msg = NULL;
|
||||||
|
SCM result;
|
||||||
|
|
||||||
|
result = scm_internal_stack_catch(SCM_BOOL_T,
|
||||||
|
gfec_string_helper,
|
||||||
|
(void *) str,
|
||||||
|
gfec_catcher,
|
||||||
|
&err_msg);
|
||||||
|
|
||||||
|
if (err_msg != NULL)
|
||||||
|
{
|
||||||
|
if (error_handler)
|
||||||
|
error_handler(err_msg);
|
||||||
|
|
||||||
|
free(err_msg);
|
||||||
|
|
||||||
|
return SCM_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static SCM
|
static SCM
|
||||||
gfec_file_helper(void *data)
|
gfec_file_helper(void *data)
|
||||||
{
|
{
|
||||||
char *file = data;
|
char *string = data;
|
||||||
|
|
||||||
return scm_c_primitive_load(file);
|
return scm_c_primitive_load(file);
|
||||||
}
|
}
|
||||||
@ -156,39 +189,6 @@ gfec_eval_file(const char *file, gfec_error_handler error_handler)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SCM
|
|
||||||
gfec_string_helper(void *data)
|
|
||||||
{
|
|
||||||
char *string = data;
|
|
||||||
|
|
||||||
return scm_c_eval_string(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
SCM
|
|
||||||
gfec_eval_string(const char *str, gfec_error_handler error_handler)
|
|
||||||
{
|
|
||||||
char *err_msg = NULL;
|
|
||||||
SCM result;
|
|
||||||
|
|
||||||
result = scm_internal_stack_catch(SCM_BOOL_T,
|
|
||||||
gfec_string_helper,
|
|
||||||
(void *) str,
|
|
||||||
gfec_catcher,
|
|
||||||
&err_msg);
|
|
||||||
|
|
||||||
if (err_msg != NULL)
|
|
||||||
{
|
|
||||||
if (error_handler)
|
|
||||||
error_handler(err_msg);
|
|
||||||
|
|
||||||
free(err_msg);
|
|
||||||
|
|
||||||
return SCM_UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct gfec_apply_rec
|
struct gfec_apply_rec
|
||||||
{
|
{
|
||||||
SCM proc;
|
SCM proc;
|
||||||
|
Loading…
Reference in New Issue
Block a user