X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fformat.c;h=5fe620b8b0425c224ea4f17a095dbef90d1e857f;hb=86eb95d2cd8b0acde9ace8fb02f3201001a9dedf;hp=aa8723482840dfb05a53057987a5d564d896c59d;hpb=7fbfc32fc3c636959b0a25b3e76609f86519e84a;p=pspp diff --git a/src/data/format.c b/src/data/format.c index aa87234828..5fe620b8b0 100644 --- a/src/data/format.c +++ b/src/data/format.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +45,8 @@ static bool valid_width (enum fmt_type, int width, bool for_input); static int max_digits_for_bytes (int bytes); -void fmt_number_style_init (struct fmt_number_style *style); +static void fmt_number_style_init (struct fmt_number_style *); +static void fmt_number_style_destroy (struct fmt_number_style *); /* Initialize the format module. */ @@ -772,15 +773,16 @@ fmt_to_io (enum fmt_type type) bool fmt_from_io (int io, enum fmt_type *fmt_type) { - enum fmt_type type; - - for (type = 0; type < FMT_NUMBER_OF_FORMATS; type++) - if (get_fmt_desc (type)->io == io) - { - *fmt_type = type; - return true; - } - return false; + switch (io) + { +#define FMT(NAME, METHOD, IMIN, OMIN, IO, CATEGORY) \ + case IO: \ + *fmt_type = FMT_##NAME; \ + return true; +#include "format.def" + default: + return false; + } } /* Returns true if TYPE may be used as an input format, @@ -856,9 +858,7 @@ max_digits_for_bytes (int bytes) return map[bytes - 1]; } - - -void +static void fmt_number_style_init (struct fmt_number_style *style) { style->neg_prefix = ss_empty (); @@ -871,7 +871,7 @@ fmt_number_style_init (struct fmt_number_style *style) /* Destroys a struct fmt_number_style. */ -void +static void fmt_number_style_destroy (struct fmt_number_style *style) { if (style != NULL)