projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
format: Optimize fmt_from_io().
[pspp]
/
src
/
data
/
format.c
diff --git
a/src/data/format.c
b/src/data/format.c
index aa8723482840dfb05a53057987a5d564d896c59d..3907016cf4dac66ba021694b175e96ef67b2761a 100644
(file)
--- a/
src/data/format.c
+++ b/
src/data/format.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* 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
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
@@
-772,15
+772,16
@@
fmt_to_io (enum fmt_type type)
bool
fmt_from_io (int io, enum fmt_type *fmt_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,
}
/* Returns true if TYPE may be used as an input format,