mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
* options.c (protected_objects, scm_init_options): The content of
protected_objects is now protected from garbage collection using scm_gc_register_root instead of scm_permanent_object. (get_option_setting): New static function that computes an option setting as it was formerly done in the function scm_options. (get_documented_option_setting): New static function that returns option documentation as it was formerly done in the function scm_options. Note that documentation C strings are no longer precomputed into SCM objects. Instead, they are converted into SCM strings every time get_documented_option_setting is called. (change_option_setting): New static functions that modifies the option setting as it was formerly done in the function scm_options. The function is now exception safe, i. e. won't cause a memory leak when interrupted. Further, only non-immediate option values are added to the protection list. (scm_options): This function now has only the purpose to dispatch to to get_option_setting, get_documented_option_setting or change_option_setting, depending on the arguments given to scm_options. (scm_init_opts): Don't convert documentation C strings into SCM strings. Further, don't protect any object values: They _must_ be immediate values, otherwise there is no guarantee that they have not been collected before anyway. * options.[ch] (scm_t_option): Made type unsigned, name into a constant char* and val into a scm_t_bits type. (scm_options, scm_init_opts): The number of options is guaranteed to be larger or equal to zero. Thus, the type is changed to unsigned.
This commit is contained in:
parent
3dbacabc55
commit
11d49f5489
3 changed files with 193 additions and 103 deletions
|
@ -55,14 +55,9 @@
|
|||
|
||||
typedef struct scm_t_option
|
||||
{
|
||||
int type;
|
||||
char *name;
|
||||
|
||||
/*
|
||||
schizophrenic use: both SCM and int
|
||||
*/
|
||||
unsigned long val;
|
||||
/* SCM val */
|
||||
unsigned int type;
|
||||
const char *name;
|
||||
scm_t_bits val;
|
||||
char *doc;
|
||||
} scm_t_option;
|
||||
|
||||
|
@ -72,8 +67,8 @@ typedef struct scm_t_option
|
|||
#define SCM_OPTION_SCM 2
|
||||
|
||||
|
||||
extern SCM scm_options (SCM new_mode, scm_t_option options[], int n, const char *s);
|
||||
extern void scm_init_opts (SCM (*func) (SCM), scm_t_option options[], int n);
|
||||
extern SCM scm_options (SCM, scm_t_option [], unsigned int, const char*);
|
||||
extern void scm_init_opts (SCM (*) (SCM), scm_t_option [], unsigned int n);
|
||||
extern void scm_init_options (void);
|
||||
|
||||
#endif /* SCM_OPTIONS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue