[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug37999 07/11] RANK: Simplify fraction_name() function.
From: |
Ben Pfaff |
Subject: |
[bug37999 07/11] RANK: Simplify fraction_name() function. |
Date: |
Thu, 31 Jan 2013 22:03:29 -0800 |
The caller only needs a constant string so we might as well just return
one directly rather than through a static buffer.
---
src/language/stats/rank.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/src/language/stats/rank.c b/src/language/stats/rank.c
index d9465ac..2088565 100644
--- a/src/language/stats/rank.c
+++ b/src/language/stats/rank.c
@@ -595,25 +595,14 @@ rank_cmd (struct dataset *ds, const struct rank *cmd);
static const char *
fraction_name (const struct rank *cmd)
{
- static char name[10];
switch (cmd->fraction )
{
- case FRAC_BLOM:
- strcpy (name, "BLOM");
- break;
- case FRAC_RANKIT:
- strcpy (name, "RANKIT");
- break;
- case FRAC_TUKEY:
- strcpy (name, "TUKEY");
- break;
- case FRAC_VW:
- strcpy (name, "VW");
- break;
- default:
- NOT_REACHED ();
+ case FRAC_BLOM: return "BLOM";
+ case FRAC_RANKIT: return "RANKIT";
+ case FRAC_TUKEY: return "TUKEY";
+ case FRAC_VW: return "VW";
+ default: NOT_REACHED ();
}
- return name;
}
/* Create a label on DEST_VAR, describing its derivation from SRC_VAR and F */
--
1.7.10.4
- [bug37999 00/11] Make RANK work with TEMPORARY., Ben Pfaff, 2013/02/01
- [bug37999 01/11] casegrouper: Add comments., Ben Pfaff, 2013/02/01
- [bug37999 04/11] RANK: Lowercase the name of "enum RANK_FUNC"., Ben Pfaff, 2013/02/01
- [bug37999 05/11] RANK: Remove write-only struct member 'ascending'., Ben Pfaff, 2013/02/01
- [bug37999 03/11] transformations: Relax the rules for transformation finalizing., Ben Pfaff, 2013/02/01
- [bug37999 06/11] RANK: Put #include directives into typical order., Ben Pfaff, 2013/02/01
- [bug37999 02/11] subcase: New function subcase_add_vars_always()., Ben Pfaff, 2013/02/01
- [bug37999 07/11] RANK: Simplify fraction_name() function.,
Ben Pfaff <=
- [bug37999 08/11] RANK: Simplify rank_sorted_file() with new function sum_weights()., Ben Pfaff, 2013/02/01
- [bug37999 09/11] RANK: Create all variables together, in order., Ben Pfaff, 2013/02/01
- [bug37999 11/11] RANK: Add support for temporary transformations., Ben Pfaff, 2013/02/01
- [bug37999 10/11] RANK: Adopt a new ranking implementation., Ben Pfaff, 2013/02/01