Skip to content

Commit 9242c13

Browse files
committed
capitialize utime statuses
1 parent 46c214d commit 9242c13

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Modules/posixmodule.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3661,11 +3661,11 @@ typedef struct {
36613661
*/
36623662

36633663
typedef enum {
3664-
utime_success = 0,
3665-
utime_parse_failure = 1,
3666-
utime_times_and_ns_collision = 2,
3667-
utime_times_conversion_failure = 3,
3668-
utime_ns_conversion_failure = 4,
3664+
UTIME_SUCCESS = 0,
3665+
UTIME_PARSE_FAILURE = 1,
3666+
UTIME_TIMES_AND_NS_COLLISION = 2,
3667+
UTIME_TIMES_CONVERSION_FAILURE = 3,
3668+
UTIME_NS_CONVERSION_FAILURE = 4,
36693669
} utime_status;
36703670

36713671
static utime_status
@@ -3697,14 +3697,14 @@ utime_read_time_arguments(utime_arguments *ua)
36973697
format, kwlist, ua->path, &times, &ns);
36983698

36993699
if (!parse_result)
3700-
return utime_parse_failure;
3700+
return UTIME_PARSE_FAILURE;
37013701

37023702
if (times && ns) {
37033703
PyErr_Format(PyExc_RuntimeError,
37043704
"%s: you may specify either 'times'"
37053705
" or 'ns' but not both",
37063706
ua->function_name);
3707-
return_value = utime_times_and_ns_collision;
3707+
return_value = UTIME_TIMES_AND_NS_COLLISION;
37083708
goto fail;
37093709
}
37103710

@@ -3714,42 +3714,42 @@ utime_read_time_arguments(utime_arguments *ua)
37143714
"%s: 'times' must be either"
37153715
" a tuple of two ints or None",
37163716
ua->function_name);
3717-
return_value = utime_times_conversion_failure;
3717+
return_value = UTIME_TIMES_CONVERSION_FAILURE;
37183718
goto fail;
37193719
}
37203720
ua->now = 0;
37213721
if (_PyTime_ObjectToTimespec(PyTuple_GET_ITEM(times, 0),
37223722
&ua->atime_s, &ua->atime_ns) == -1 ||
37233723
_PyTime_ObjectToTimespec(PyTuple_GET_ITEM(times, 1),
37243724
&ua->mtime_s, &ua->mtime_ns) == -1) {
3725-
return_value = utime_times_conversion_failure;
3725+
return_value = UTIME_TIMES_CONVERSION_FAILURE;
37263726
goto fail;
37273727
}
3728-
return utime_success;
3728+
return UTIME_SUCCESS;
37293729
}
37303730

37313731
if (ns) {
37323732
if (!PyTuple_CheckExact(ns) || (PyTuple_Size(ns) != 2)) {
37333733
PyErr_Format(PyExc_TypeError,
37343734
"%s: 'ns' must be a tuple of two ints",
37353735
ua->function_name);
3736-
return_value = utime_ns_conversion_failure;
3736+
return_value = UTIME_NS_CONVERSION_FAILURE;
37373737
goto fail;
37383738
}
37393739
ua->now = 0;
37403740
if (!split_py_long_to_s_and_ns(PyTuple_GET_ITEM(ns, 0),
37413741
&ua->atime_s, &ua->atime_ns) ||
37423742
!split_py_long_to_s_and_ns(PyTuple_GET_ITEM(ns, 1),
37433743
&ua->mtime_s, &ua->mtime_ns)) {
3744-
return_value = utime_ns_conversion_failure;
3744+
return_value = UTIME_NS_CONVERSION_FAILURE;
37453745
goto fail;
37463746
}
3747-
return utime_success;
3747+
return UTIME_SUCCESS;
37483748
}
37493749

37503750
/* either times=None, or neither times nor ns was specified. use "now". */
37513751
ua->now = 1;
3752-
return utime_success;
3752+
return UTIME_SUCCESS;
37533753

37543754
fail:
37553755
if (ua->converter)
@@ -3786,7 +3786,7 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs)
37863786
switch (utime_read_time_arguments(&ua)) {
37873787
default:
37883788
return NULL;
3789-
case utime_success: {
3789+
case UTIME_SUCCESS: {
37903790
wchar_t *wpath = PyUnicode_AsUnicode(upath);
37913791
if (wpath == NULL)
37923792
return NULL;
@@ -3799,15 +3799,15 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs)
37993799
return win32_error_object("utime", upath);
38003800
break;
38013801
}
3802-
case utime_parse_failure: {
3802+
case UTIME_PARSE_FAILURE: {
38033803
const char *apath;
38043804
/* Drop the argument parsing error as narrow strings
38053805
are also valid. */
38063806
PyErr_Clear();
38073807

38083808
ua.path_format = 'y';
38093809
ua.path = (PyObject **)&apath;
3810-
if (utime_read_time_arguments(&ua) != utime_success)
3810+
if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
38113811
return NULL;
38123812
if (win32_warn_bytes_api())
38133813
return NULL;
@@ -3862,7 +3862,7 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs)
38623862
ua.path = &opath;
38633863
ua.converter = PyUnicode_FSConverter;
38643864

3865-
if (utime_read_time_arguments(&ua) != utime_success)
3865+
if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
38663866
return NULL;
38673867
path = PyBytes_AsString(opath);
38683868
if (ua.now) {
@@ -3915,7 +3915,7 @@ posix_futimes(PyObject *self, PyObject *args, PyObject *kwargs)
39153915
ua.path = (PyObject **)&fd;
39163916
ua.first_argument_name = "fd";
39173917

3918-
if (utime_read_time_arguments(&ua) != utime_success)
3918+
if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
39193919
return NULL;
39203920

39213921
if (ua.now) {
@@ -3960,7 +3960,7 @@ posix_lutimes(PyObject *self, PyObject *args, PyObject *kwargs)
39603960
ua.path = &opath;
39613961
ua.converter = PyUnicode_FSConverter;
39623962

3963-
if (utime_read_time_arguments(&ua) != utime_success)
3963+
if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
39643964
return NULL;
39653965
path = PyBytes_AsString(opath);
39663966

0 commit comments

Comments
 (0)