1
0
mirror of https://git.code.sf.net/p/mingw-w64/mingw-w64 synced 2025-04-18 17:44:18 +03:00

crt: Avoid memset calls in stat functions implementation.

In preparation for building the CRT with -fno-builtin. This allows the compiler
to zero memory without making an actual library call.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
Jacek Caban 2025-03-22 12:43:07 +01:00
parent 475fc9674e
commit 7ea592a7ba
9 changed files with 11 additions and 11 deletions

View File

@ -7,7 +7,7 @@ intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *
struct __finddata64_t fd;
intptr_t ret = _findfirst64(_Filename,&fd);
if (ret == -1) {
memset(_FindData,0,sizeof(struct _finddata64i32_t));
*_FindData = (struct _finddata64i32_t){0};
return -1;
}
_FindData->attrib=fd.attrib;

View File

@ -7,7 +7,7 @@ int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindDa
struct __finddata64_t fd;
int ret = _findnext64(_FindHandle,&fd);
if (ret == -1) {
memset(_FindData,0,sizeof(struct _finddata64i32_t));
*_FindData = (struct _finddata64i32_t){0};
return -1;
}
_FindData->attrib=fd.attrib;

View File

@ -6,7 +6,7 @@ int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat)
struct _stat64 st;
int ret=_fstat64(_FileDes,&st);
if (ret == -1) {
memset(_Stat,0,sizeof(struct _stat64i32));
*_Stat = (struct _stat64i32){0};
return -1;
}
_Stat->st_dev=st.st_dev;

View File

@ -74,7 +74,7 @@ stat(const char *_Filename,struct stat *_Stat)
free (_path);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
*_Stat = (struct stat){0};
return -1;
}
/* struct stat and struct _stat32
@ -95,7 +95,7 @@ stat(const char *_Filename,struct stat *_Stat)
free (_path);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
*_Stat = (struct stat){0};
return -1;
}
/* struct stat and struct _stat64i32

View File

@ -69,7 +69,7 @@ int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat)
free(_path);
if (ret == -1) {
memset(_Stat,0,sizeof(struct _stat64i32));
*_Stat = (struct _stat64i32){0};
return -1;
}
_Stat->st_dev=st.st_dev;

View File

@ -7,7 +7,7 @@ intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i3
struct _wfinddata64_t fd;
intptr_t ret = _wfindfirst64(_Filename,&fd);
if (ret == -1) {
memset(_FindData,0,sizeof(struct _wfinddata64i32_t));
*_FindData = (struct _wfinddata64i32_t){0};
return -1;
}
_FindData->attrib=fd.attrib;

View File

@ -7,7 +7,7 @@ int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_Find
struct _wfinddata64_t fd;
int ret = _wfindnext64(_FindHandle,&fd);
if (ret == -1) {
memset(_FindData,0,sizeof(struct _wfinddata64i32_t));
*_FindData = (struct _wfinddata64i32_t){0};
return -1;
}
_FindData->attrib=fd.attrib;

View File

@ -76,7 +76,7 @@ wstat(const wchar_t *_Filename,struct stat *_Stat)
free (_path);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
*_Stat = (struct stat){0};
return -1;
}
/* struct stat and struct _stat32
@ -97,7 +97,7 @@ wstat(const wchar_t *_Filename,struct stat *_Stat)
free (_path);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
*_Stat = (struct stat){0};
return -1;
}
/* struct stat and struct _stat64i32

View File

@ -69,7 +69,7 @@ int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat)
free(_path);
if (ret == -1) {
memset(_Stat,0,sizeof(struct _stat64i32));
*_Stat = (struct _stat64i32){0};
return -1;
}
_Stat->st_dev=st.st_dev;