Replace a buch of "const static" with "static const"

C18 section 6.11.5 says that "const static" is obsolescent.
This commit is contained in:
Ben Harris
2023-02-18 22:04:52 +00:00
parent 5fa60c4d46
commit d7b931824b
2 changed files with 23 additions and 23 deletions

View File

@ -123,7 +123,7 @@ static game_params *default_params(void)
return ret; return ret;
} }
const static struct game_params group_presets[] = { static const struct game_params group_presets[] = {
{ 6, DIFF_NORMAL, true }, { 6, DIFF_NORMAL, true },
{ 6, DIFF_NORMAL, false }, { 6, DIFF_NORMAL, false },
{ 8, DIFF_NORMAL, true }, { 8, DIFF_NORMAL, true },

View File

@ -549,47 +549,47 @@ static int perform_sqrt(int *a, int *b, int *output)
return perform_exp(a, half, output); return perform_exp(a, half, output);
} }
const static struct operation op_add = { static const struct operation op_add = {
true, "+", "+", 0, 10, 0, true, perform_add true, "+", "+", 0, 10, 0, true, perform_add
}; };
const static struct operation op_sub = { static const struct operation op_sub = {
true, "-", "-", 0, 10, 2, false, perform_sub true, "-", "-", 0, 10, 2, false, perform_sub
}; };
const static struct operation op_mul = { static const struct operation op_mul = {
true, "*", "*", 0, 20, 0, true, perform_mul true, "*", "*", 0, 20, 0, true, perform_mul
}; };
const static struct operation op_div = { static const struct operation op_div = {
true, "/", "/", 0, 20, 2, false, perform_div true, "/", "/", 0, 20, 2, false, perform_div
}; };
const static struct operation op_xdiv = { static const struct operation op_xdiv = {
true, "/", "/", 0, 20, 2, false, perform_exact_div true, "/", "/", 0, 20, 2, false, perform_exact_div
}; };
const static struct operation op_concat = { static const struct operation op_concat = {
false, "", "concat", OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT, false, "", "concat", OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT,
1000, 0, false, perform_concat 1000, 0, false, perform_concat
}; };
const static struct operation op_exp = { static const struct operation op_exp = {
true, "^", "^", 0, 30, 1, false, perform_exp true, "^", "^", 0, 30, 1, false, perform_exp
}; };
const static struct operation op_factorial = { static const struct operation op_factorial = {
true, "!", "!", OPFLAG_UNARY, 40, 0, false, perform_factorial true, "!", "!", OPFLAG_UNARY, 40, 0, false, perform_factorial
}; };
const static struct operation op_decimal = { static const struct operation op_decimal = {
true, ".", ".", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT, 50, 0, false, perform_decimal true, ".", ".", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT, 50, 0, false, perform_decimal
}; };
const static struct operation op_recur = { static const struct operation op_recur = {
true, "...", "recur", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 2, false, perform_recur true, "...", "recur", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 2, false, perform_recur
}; };
const static struct operation op_root = { static const struct operation op_root = {
true, "v~", "root", 0, 30, 1, false, perform_root true, "v~", "root", 0, 30, 1, false, perform_root
}; };
const static struct operation op_perc = { static const struct operation op_perc = {
true, "%", "%", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 1, false, perform_perc true, "%", "%", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 1, false, perform_perc
}; };
const static struct operation op_gamma = { static const struct operation op_gamma = {
true, "gamma", "gamma", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_FN, 1, 3, false, perform_gamma true, "gamma", "gamma", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_FN, 1, 3, false, perform_gamma
}; };
const static struct operation op_sqrt = { static const struct operation op_sqrt = {
true, "v~", "sqrt", OPFLAG_UNARY | OPFLAG_UNARYPREFIX, 30, 1, false, perform_sqrt true, "v~", "sqrt", OPFLAG_UNARY | OPFLAG_UNARYPREFIX, 30, 1, false, perform_sqrt
}; };
@ -597,10 +597,10 @@ const static struct operation op_sqrt = {
* In Countdown, divisions resulting in fractions are disallowed. * In Countdown, divisions resulting in fractions are disallowed.
* http://www.askoxford.com/wordgames/countdown/rules/ * http://www.askoxford.com/wordgames/countdown/rules/
*/ */
const static struct operation *const ops_countdown[] = { static const struct operation *const ops_countdown[] = {
&op_add, &op_mul, &op_sub, &op_xdiv, NULL &op_add, &op_mul, &op_sub, &op_xdiv, NULL
}; };
const static struct rules rules_countdown = { static const struct rules rules_countdown = {
ops_countdown, false ops_countdown, false
}; };
@ -609,10 +609,10 @@ const static struct rules rules_countdown = {
* known puzzle of making 24 using two 3s and two 8s. For this we * known puzzle of making 24 using two 3s and two 8s. For this we
* need rational rather than integer division. * need rational rather than integer division.
*/ */
const static struct operation *const ops_3388[] = { static const struct operation *const ops_3388[] = {
&op_add, &op_mul, &op_sub, &op_div, NULL &op_add, &op_mul, &op_sub, &op_div, NULL
}; };
const static struct rules rules_3388 = { static const struct rules rules_3388 = {
ops_3388, true ops_3388, true
}; };
@ -620,10 +620,10 @@ const static struct rules rules_3388 = {
* A still more permissive rule set usable for the four-4s problem * A still more permissive rule set usable for the four-4s problem
* and similar things. Permits concatenation. * and similar things. Permits concatenation.
*/ */
const static struct operation *const ops_four4s[] = { static const struct operation *const ops_four4s[] = {
&op_add, &op_mul, &op_sub, &op_div, &op_concat, NULL &op_add, &op_mul, &op_sub, &op_div, &op_concat, NULL
}; };
const static struct rules rules_four4s = { static const struct rules rules_four4s = {
ops_four4s, true ops_four4s, true
}; };
@ -631,11 +631,11 @@ const static struct rules rules_four4s = {
* The most permissive ruleset I can think of. Permits * The most permissive ruleset I can think of. Permits
* exponentiation, and also silly unary operators like factorials. * exponentiation, and also silly unary operators like factorials.
*/ */
const static struct operation *const ops_anythinggoes[] = { static const struct operation *const ops_anythinggoes[] = {
&op_add, &op_mul, &op_sub, &op_div, &op_concat, &op_exp, &op_factorial, &op_add, &op_mul, &op_sub, &op_div, &op_concat, &op_exp, &op_factorial,
&op_decimal, &op_recur, &op_root, &op_perc, &op_gamma, &op_sqrt, NULL &op_decimal, &op_recur, &op_root, &op_perc, &op_gamma, &op_sqrt, NULL
}; };
const static struct rules rules_anythinggoes = { static const struct rules rules_anythinggoes = {
ops_anythinggoes, true ops_anythinggoes, true
}; };