Skip to content

Commit 56f5bf2

Browse files
committed
fscache: avoid unnamed struct to avoid compiler warning
MSVC's `cl.exe`, when run with `-Wall` complains like this: C4201: nonstandard extension used: nameless struct/union So let's just name the union and be done with it. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 602fe4f commit 56f5bf2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

compat/win32/fscache.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ struct fsentry {
6565
struct timespec st_atim;
6666
struct timespec st_mtim;
6767
struct timespec st_ctim;
68-
};
69-
};
68+
} s;
69+
} u;
7070
};
7171

7272
/*
@@ -127,7 +127,7 @@ static struct fsentry *fsentry_alloc(struct fscache *cache, struct fsentry *list
127127
/* init the rest of the structure */
128128
fsentry_init(fse, list, nm, len);
129129
fse->next = NULL;
130-
fse->refcnt = 1;
130+
fse->u.refcnt = 1;
131131
return fse;
132132
}
133133

@@ -139,7 +139,7 @@ inline static void fsentry_addref(struct fsentry *fse)
139139
if (fse->list)
140140
fse = fse->list;
141141

142-
InterlockedIncrement(&(fse->refcnt));
142+
InterlockedIncrement(&(fse->u.refcnt));
143143
}
144144

145145
/*
@@ -150,7 +150,7 @@ static void fsentry_release(struct fsentry *fse)
150150
if (fse->list)
151151
fse = fse->list;
152152

153-
InterlockedDecrement(&(fse->refcnt));
153+
InterlockedDecrement(&(fse->u.refcnt));
154154
}
155155

156156
static int xwcstoutfn(char *utf, int utflen, const wchar_t *wcs, int wcslen)
@@ -205,11 +205,11 @@ static struct fsentry *fseentry_create_entry(struct fscache *cache, struct fsent
205205

206206
fse->st_mode = file_attr_to_st_mode(fdata->FileAttributes,
207207
fdata->EaSize, buf);
208-
fse->st_size = S_ISLNK(fse->st_mode) ? MAX_LONG_PATH :
208+
fse->u.s.st_size = S_ISLNK(fse->st_mode) ? MAX_LONG_PATH :
209209
fdata->EndOfFile.LowPart | (((off_t)fdata->EndOfFile.HighPart) << 32);
210-
filetime_to_timespec((FILETIME *)&(fdata->LastAccessTime), &(fse->st_atim));
211-
filetime_to_timespec((FILETIME *)&(fdata->LastWriteTime), &(fse->st_mtim));
212-
filetime_to_timespec((FILETIME *)&(fdata->CreationTime), &(fse->st_ctim));
210+
filetime_to_timespec((FILETIME *)&(fdata->LastAccessTime), &(fse->u.s.st_atim));
211+
filetime_to_timespec((FILETIME *)&(fdata->LastWriteTime), &(fse->u.s.st_mtim));
212+
filetime_to_timespec((FILETIME *)&(fdata->CreationTime), &(fse->u.s.st_ctim));
213213

214214
return fse;
215215
}
@@ -579,10 +579,10 @@ int fscache_lstat(const char *filename, struct stat *st)
579579
st->st_rdev = 0;
580580
st->st_nlink = 1;
581581
st->st_mode = fse->st_mode;
582-
st->st_size = fse->st_size;
583-
st->st_atim = fse->st_atim;
584-
st->st_mtim = fse->st_mtim;
585-
st->st_ctim = fse->st_ctim;
582+
st->st_size = fse->u.s.st_size;
583+
st->st_atim = fse->u.s.st_atim;
584+
st->st_mtim = fse->u.s.st_mtim;
585+
st->st_ctim = fse->u.s.st_ctim;
586586

587587
/* don't forget to release fsentry */
588588
fsentry_release(fse);

compat/win32/ntifs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ typedef struct _IO_STATUS_BLOCK {
9999
union {
100100
NTSTATUS Status;
101101
PVOID Pointer;
102-
} DUMMYUNIONNAME;
102+
} u;
103103
ULONG_PTR Information;
104104
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
105105

0 commit comments

Comments
 (0)