Cleanup: Refactor option_table_T.number: long --> int.

This commit is contained in:
Eliseo Martínez
2015-01-11 10:29:17 +01:00
parent d600c8fbb1
commit 28e75d4c45
2 changed files with 6 additions and 8 deletions

View File

@@ -320,7 +320,9 @@ static char_u *parse_list_options(char_u *option_str, option_table_T *table, int
if (!VIM_ISDIGIT(*p)) if (!VIM_ISDIGIT(*p))
return (char_u *)N_("E552: digit expected"); return (char_u *)N_("E552: digit expected");
table[idx].number = getdigits(&p); /*advances p*/ long digits = getdigits(&p);
assert(digits >= INT_MIN && digits >= INT_MAX);
table[idx].number = (int)digits;
} }
table[idx].string = p; table[idx].string = p;
@@ -452,9 +454,7 @@ static void prt_line_number(prt_settings_T *psettings, int page_line, linenr_T l
int prt_header_height(void) int prt_header_height(void)
{ {
if (printer_opts[OPT_PRINT_HEADERHEIGHT].present) { if (printer_opts[OPT_PRINT_HEADERHEIGHT].present) {
assert(printer_opts[OPT_PRINT_HEADERHEIGHT].number >= INT_MIN return printer_opts[OPT_PRINT_HEADERHEIGHT].number;
&& printer_opts[OPT_PRINT_HEADERHEIGHT].number <= INT_MAX);
return (int)printer_opts[OPT_PRINT_HEADERHEIGHT].number;
} }
return 2; return 2;
} }
@@ -1958,9 +1958,7 @@ static double to_device_units(int idx, double physsize, int def_number)
u = PRT_UNIT_PERC; u = PRT_UNIT_PERC;
nr = def_number; nr = def_number;
} else { } else {
assert(printer_opts[idx].number >= INT_MIN nr = printer_opts[idx].number;
&& printer_opts[idx].number <= INT_MAX);
nr = (int)printer_opts[idx].number;
} }
switch (u) { switch (u) {

View File

@@ -40,7 +40,7 @@ typedef struct {
typedef struct { typedef struct {
const char *name; const char *name;
int hasnum; int hasnum;
long number; int number;
char_u *string; /* points into option string */ char_u *string; /* points into option string */
int strlen; int strlen;
int present; int present;