Skip to content

Commit 2d793e9

Browse files
tobluxKent Overstreet
authored andcommitted
bcachefs: Rename struct field swap to prevent macro naming collision
The struct field swap can collide with the swap() macro defined in linux/minmax.h. Rename the struct field to prevent such collisions. Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 7d83cf5 commit 2d793e9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

fs/bcachefs/eytzinger.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void swap_bytes(void *a, void *b, size_t n)
115115

116116
struct wrapper {
117117
cmp_func_t cmp;
118-
swap_func_t swap;
118+
swap_func_t swap_func;
119119
};
120120

121121
/*
@@ -125,7 +125,7 @@ struct wrapper {
125125
static void do_swap(void *a, void *b, size_t size, swap_r_func_t swap_func, const void *priv)
126126
{
127127
if (swap_func == SWAP_WRAPPER) {
128-
((const struct wrapper *)priv)->swap(a, b, (int)size);
128+
((const struct wrapper *)priv)->swap_func(a, b, (int)size);
129129
return;
130130
}
131131

@@ -174,7 +174,7 @@ void eytzinger0_sort_r(void *base, size_t n, size_t size,
174174
int i, c, r;
175175

176176
/* called from 'sort' without swap function, let's pick the default */
177-
if (swap_func == SWAP_WRAPPER && !((struct wrapper *)priv)->swap)
177+
if (swap_func == SWAP_WRAPPER && !((struct wrapper *)priv)->swap_func)
178178
swap_func = NULL;
179179

180180
if (!swap_func) {
@@ -227,7 +227,7 @@ void eytzinger0_sort(void *base, size_t n, size_t size,
227227
{
228228
struct wrapper w = {
229229
.cmp = cmp_func,
230-
.swap = swap_func,
230+
.swap_func = swap_func,
231231
};
232232

233233
return eytzinger0_sort_r(base, n, size, _CMP_WRAPPER, SWAP_WRAPPER, &w);

0 commit comments

Comments
 (0)