Skip to content

Commit 91d03cb

Browse files
committed
Fix build with GCC v14.1 (#4962)
The GCC v14.1 upgrade broke the build of `git-artifacts`. Partially, this has been fixed upstream already, but the i686 build requires a separate fix. This addresses #4953.
2 parents 7f8c443 + a74a04f commit 91d03cb

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

compat/regex/regcomp.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
868868
if (table_size > pat_len)
869869
break;
870870

871-
dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
871+
dfa->state_table = calloc (table_size, sizeof (struct re_state_table_entry));
872872
dfa->state_hash_mask = table_size - 1;
873873

874874
dfa->mb_cur_max = MB_CUR_MAX;
@@ -936,7 +936,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
936936
{
937937
int i, j, ch;
938938

939-
dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
939+
dfa->sb_char = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
940940
if (BE (dfa->sb_char == NULL, 0))
941941
return REG_ESPACE;
942942

@@ -3079,9 +3079,9 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
30793079
_NL_COLLATE_SYMB_EXTRAMB);
30803080
}
30813081
#endif
3082-
sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
3082+
sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
30833083
#ifdef RE_ENABLE_I18N
3084-
mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
3084+
mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
30853085
#endif /* RE_ENABLE_I18N */
30863086
#ifdef RE_ENABLE_I18N
30873087
if (BE (sbcset == NULL || mbcset == NULL, 0))
@@ -3626,9 +3626,9 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
36263626
re_token_t br_token;
36273627
bin_tree_t *tree;
36283628

3629-
sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
3629+
sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
36303630
#ifdef RE_ENABLE_I18N
3631-
mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
3631+
mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
36323632
#endif /* RE_ENABLE_I18N */
36333633

36343634
#ifdef RE_ENABLE_I18N

compat/regex/regex_internal.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
16281628
reg_errcode_t err;
16291629
re_dfastate_t *newstate;
16301630

1631-
newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
1631+
newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
16321632
if (BE (newstate == NULL, 0))
16331633
return NULL;
16341634
err = re_node_set_init_copy (&newstate->nodes, nodes);
@@ -1678,7 +1678,7 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
16781678
reg_errcode_t err;
16791679
re_dfastate_t *newstate;
16801680

1681-
newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
1681+
newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
16821682
if (BE (newstate == NULL, 0))
16831683
return NULL;
16841684
err = re_node_set_init_copy (&newstate->nodes, nodes);

compat/regex/regexec.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -2796,8 +2796,8 @@ get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
27962796
continue; /* No. */
27972797
if (sub_top->path == NULL)
27982798
{
2799-
sub_top->path = calloc (sizeof (state_array_t),
2800-
sl_str - sub_top->str_idx + 1);
2799+
sub_top->path = calloc (sl_str - sub_top->str_idx + 1,
2800+
sizeof (state_array_t));
28012801
if (sub_top->path == NULL)
28022802
return REG_ESPACE;
28032803
}
@@ -3361,7 +3361,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
33613361
if (ndests == 0)
33623362
{
33633363
state->trtable = (re_dfastate_t **)
3364-
calloc (sizeof (re_dfastate_t *), SBC_MAX);
3364+
calloc (SBC_MAX, sizeof (re_dfastate_t *));
33653365
return 1;
33663366
}
33673367
return 0;
@@ -3457,7 +3457,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
34573457
discern by looking at the character code: allocate a
34583458
256-entry transition table. */
34593459
trtable = state->trtable =
3460-
(re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX);
3460+
(re_dfastate_t **) calloc (SBC_MAX, sizeof (re_dfastate_t *));
34613461
if (BE (trtable == NULL, 0))
34623462
goto out_free;
34633463

@@ -3488,7 +3488,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
34883488
transition tables, one starting at trtable[0] and one
34893489
starting at trtable[SBC_MAX]. */
34903490
trtable = state->word_trtable =
3491-
(re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX);
3491+
(re_dfastate_t **) calloc (2 * SBC_MAX, sizeof (re_dfastate_t *));
34923492
if (BE (trtable == NULL, 0))
34933493
goto out_free;
34943494

git-compat-util.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ struct strbuf;
166166
/* Approximation of the length of the decimal representation of this type. */
167167
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
168168

169-
#ifdef __MINGW64__
169+
#if defined(__MINGW32__) || defined(__MINGW64__)
170170
#define _POSIX_C_SOURCE 1
171171
#elif defined(__sun__)
172172
/*

0 commit comments

Comments
 (0)