mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Removing unused timespec function
This commit is contained in:
parent
ee56f5df78
commit
168f6d6740
@ -2085,112 +2085,6 @@ gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb,
|
|||||||
return strdup(default_value);
|
return strdup(default_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
|
||||||
* gnc_option_db_lookup_date_option *
|
|
||||||
* looks up a date option. If present, returns the absolute date *
|
|
||||||
* represented in the set_ab_value argument provided, otherwise *
|
|
||||||
* copies the default_value argument (if non-NULL) to the *
|
|
||||||
* set_ab_value argument. If the default_value argument is NULL, *
|
|
||||||
* copies the current date to set_ab_value. Whatever value is *
|
|
||||||
* stored in set_ab_value is returned as an approximate (no *
|
|
||||||
* nanoseconds) time64 value. set_ab_value may be NULL, in which *
|
|
||||||
* case only the return value can be used. If is_relative is *
|
|
||||||
* non-NULL, it is set to whether the date option is currently *
|
|
||||||
* storing a relative date. If it is, and set_rel_value *
|
|
||||||
* is non-NULL, it returns a newly allocated string *
|
|
||||||
* representing the scheme symbol for that relative date *
|
|
||||||
* *
|
|
||||||
* Args: odb - option database to search in *
|
|
||||||
* section - section name of option *
|
|
||||||
* name - name of option *
|
|
||||||
* is_relative - location to store boolean value *
|
|
||||||
* set_ab_value - location to store absolute option value *
|
|
||||||
* set_rel_value - location to store relative option value *
|
|
||||||
* default - default value if not found *
|
|
||||||
* Return: time64 approximation of set_value *
|
|
||||||
\********************************************************************/
|
|
||||||
time64
|
|
||||||
gnc_option_db_lookup_date_option(GNCOptionDB *odb,
|
|
||||||
const char *section,
|
|
||||||
const char *name,
|
|
||||||
gboolean *is_relative,
|
|
||||||
Timespec *set_ab_value,
|
|
||||||
char **set_rel_value,
|
|
||||||
Timespec *default_value)
|
|
||||||
{
|
|
||||||
GNCOption *option;
|
|
||||||
Timespec temp = {0, 0};
|
|
||||||
char *symbol;
|
|
||||||
SCM getter;
|
|
||||||
SCM value;
|
|
||||||
|
|
||||||
initialize_getters();
|
|
||||||
|
|
||||||
if (set_ab_value == NULL)
|
|
||||||
{
|
|
||||||
set_ab_value = &temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (set_rel_value != NULL)
|
|
||||||
{
|
|
||||||
*set_rel_value = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_relative != NULL)
|
|
||||||
{
|
|
||||||
*is_relative = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
option = gnc_option_db_get_option_by_name(odb, section, name);
|
|
||||||
|
|
||||||
if (option != NULL)
|
|
||||||
{
|
|
||||||
getter = gnc_option_getter(option);
|
|
||||||
if (getter != SCM_UNDEFINED)
|
|
||||||
{
|
|
||||||
value = scm_call_0(getter);
|
|
||||||
|
|
||||||
if (scm_is_pair(value))
|
|
||||||
{
|
|
||||||
Timespec absolute;
|
|
||||||
|
|
||||||
absolute = gnc_date_option_value_get_absolute (value);
|
|
||||||
|
|
||||||
*set_ab_value = absolute;
|
|
||||||
|
|
||||||
symbol = gnc_date_option_value_get_type (value);
|
|
||||||
|
|
||||||
if (g_strcmp0(symbol, "relative") == 0)
|
|
||||||
{
|
|
||||||
SCM relative = gnc_date_option_value_get_relative (value);
|
|
||||||
|
|
||||||
if (is_relative != NULL)
|
|
||||||
*is_relative = TRUE;
|
|
||||||
|
|
||||||
if (set_rel_value != NULL)
|
|
||||||
*set_rel_value = gnc_scm_symbol_to_locale_string (relative);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (symbol);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (default_value == NULL)
|
|
||||||
{
|
|
||||||
set_ab_value->tv_sec = gnc_time (NULL);
|
|
||||||
set_ab_value->tv_nsec = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*set_ab_value = *default_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return set_ab_value->tv_sec;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_option_db_lookup_number_option *
|
* gnc_option_db_lookup_number_option *
|
||||||
* looks up a number option. If present, returns its value *
|
* looks up a number option. If present, returns its value *
|
||||||
|
@ -182,14 +182,6 @@ char * gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb,
|
|||||||
const char *name,
|
const char *name,
|
||||||
const char *default_value);
|
const char *default_value);
|
||||||
|
|
||||||
time64 gnc_option_db_lookup_date_option(GNCOptionDB *odb,
|
|
||||||
const char *section,
|
|
||||||
const char *name,
|
|
||||||
gboolean *is_relative,
|
|
||||||
Timespec *set_ab_value,
|
|
||||||
char **set_rel_value,
|
|
||||||
Timespec *default_value);
|
|
||||||
|
|
||||||
gdouble gnc_option_db_lookup_number_option(GNCOptionDB *odb,
|
gdouble gnc_option_db_lookup_number_option(GNCOptionDB *odb,
|
||||||
const char *section,
|
const char *section,
|
||||||
const char *name,
|
const char *name,
|
||||||
|
Loading…
Reference in New Issue
Block a user