From 89acb8f534e75a1b14a23e5e397f55589e2d6fc9 Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Tue, 27 Jun 2006 14:13:04 +0200 Subject: [PATCH] INT/LONG: introduce long_wr() and long_set() and use them instead of num_wr() and num_set() for options of type OPT_LONG. (cherry picked from commit 9412cc77f03ddf7dd373faa4084a2c4847594c59) --- src/config/opttypes.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/config/opttypes.c b/src/config/opttypes.c index 8866e31e3..4a5653939 100644 --- a/src/config/opttypes.c +++ b/src/config/opttypes.c @@ -213,6 +213,19 @@ num_wr(struct option *option, struct string *string) } +static int +long_set(struct option *opt, unsigned char *str) +{ + opt->value.big_number = *((long *) str); + return 1; +} + +static void +long_wr(struct option *option, struct string *string) +{ + add_knum_to_string(string, option->value.big_number); +} + static unsigned char * str_rd(struct option *opt, unsigned char **file, int *line) { @@ -388,7 +401,7 @@ tree_dup(struct option *opt, struct option *template) const struct option_type_info option_types[] = { { N_("Boolean"), bool_cmd, num_rd, num_wr, NULL, num_set, NULL, N_("[0|1]") }, { N_("Integer"), gen_cmd, num_rd, num_wr, NULL, num_set, NULL, N_("") }, - { N_("Longint"), gen_cmd, num_rd, num_wr, NULL, num_set, NULL, N_("") }, + { N_("Longint"), gen_cmd, num_rd, long_wr, NULL, long_set, NULL, N_("") }, { N_("String"), gen_cmd, str_rd, str_wr, str_dup, str_set, NULL, N_("") }, { N_("Codepage"), gen_cmd, str_rd, cp_wr, NULL, cp_set, NULL, N_("") },