Skip to content

Commit 9de0fa8

Browse files
committed
Issue #23152: Renames time_t_to_FILE_TIME to _Py_time_t_to_FILE_TIME, removes unused struct win32_stat and return value
1 parent 7cb695f commit 9de0fa8

2 files changed

Lines changed: 6 additions & 26 deletions

File tree

Modules/posixmodule.c

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,24 +1451,6 @@ win32_wchdir(LPCWSTR path)
14511451
#define HAVE_STAT_NSEC 1
14521452
#define HAVE_STRUCT_STAT_ST_FILE_ATTRIBUTES 1
14531453

1454-
struct win32_stat{
1455-
unsigned long st_dev;
1456-
__int64 st_ino;
1457-
unsigned short st_mode;
1458-
int st_nlink;
1459-
int st_uid;
1460-
int st_gid;
1461-
unsigned long st_rdev;
1462-
__int64 st_size;
1463-
time_t st_atime;
1464-
int st_atime_nsec;
1465-
time_t st_mtime;
1466-
int st_mtime_nsec;
1467-
time_t st_ctime;
1468-
int st_ctime_nsec;
1469-
unsigned long st_file_attributes;
1470-
};
1471-
14721454
static BOOL
14731455
attributes_from_dir(LPCSTR pszFile, BY_HANDLE_FILE_INFORMATION *info, ULONG *reparse_tag)
14741456
{
@@ -1579,7 +1561,7 @@ get_target_path(HANDLE hdl, wchar_t **target_path)
15791561
}
15801562

15811563
/* defined in fileutils.c */
1582-
int
1564+
void
15831565
_Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag, struct _Py_stat_struct *result);
15841566

15851567
static int
@@ -6221,7 +6203,7 @@ os_utime(PyModuleDef *module, PyObject *args, PyObject *kwargs)
62216203

62226204
#ifdef MS_WINDOWS
62236205
void
6224-
time_t_to_FILE_TIME(time_t time_in, int nsec_in, FILETIME *out_ptr);
6206+
_Py_time_t_to_FILE_TIME(time_t time_in, int nsec_in, FILETIME *out_ptr);
62256207
#endif
62266208

62276209
static PyObject *
@@ -6327,8 +6309,8 @@ os_utime_impl(PyModuleDef *module, path_t *path, PyObject *times, PyObject *ns,
63276309
atime = mtime;
63286310
}
63296311
else {
6330-
time_t_to_FILE_TIME(utime.atime_s, utime.atime_ns, &atime);
6331-
time_t_to_FILE_TIME(utime.mtime_s, utime.mtime_ns, &mtime);
6312+
_Py_time_t_to_FILE_TIME(utime.atime_s, utime.atime_ns, &atime);
6313+
_Py_time_t_to_FILE_TIME(utime.mtime_s, utime.mtime_ns, &mtime);
63326314
}
63336315
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
63346316
/* Avoid putting the file name into the error here,

Python/fileutils.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, time_t *time_out, int* nsec_out)
563563
}
564564

565565
void
566-
time_t_to_FILE_TIME(time_t time_in, int nsec_in, FILETIME *out_ptr)
566+
_Py_time_t_to_FILE_TIME(time_t time_in, int nsec_in, FILETIME *out_ptr)
567567
{
568568
/* XXX endianness */
569569
__int64 out;
@@ -591,7 +591,7 @@ attributes_to_mode(DWORD attr)
591591
return m;
592592
}
593593

594-
int
594+
void
595595
_Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag, struct _Py_stat_struct *result)
596596
{
597597
memset(result, 0, sizeof(*result));
@@ -611,8 +611,6 @@ _Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag,
611611
result->st_mode |= S_IFLNK;
612612
}
613613
result->st_file_attributes = info->dwFileAttributes;
614-
615-
return 0;
616614
}
617615
#endif
618616

0 commit comments

Comments
 (0)