RANK: Simplify fraction_name() function.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 24 Jan 2013 06:55:24 +0000 (22:55 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 31 Jan 2013 05:04:24 +0000 (21:04 -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

index d9465ac4222c43c18bbbb326fa4fda95d0687ec9..20885659e6618f34921a6f3bcfb6eca11bdae860 100644 (file)
@@ -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 */