Skip to content

Commit 758dfe5

Browse files
committed
reduce diff even futher
1 parent 55a491a commit 758dfe5

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

Modules/_cursesmodule.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ _curses_window_addstr_impl(PyCursesWindowObject *self, int group_left_1,
11991199
Py_DECREF(bytesobj);
12001200
}
12011201
if (use_attr)
1202-
(void)wattrset(self->win, attr_old);
1202+
(void)wattrset(self->win,attr_old);
12031203
return PyCursesCheckERR_ForWin_From(self, rtn,
12041204
simple_funcname,
12051205
curses_funcname);
@@ -1875,20 +1875,21 @@ _curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
18751875
/*[clinic end generated code: output=9f4f86e91fe50ef3 input=dd7e5367fb49dc48]*/
18761876
{
18771877
int ct;
1878-
wint_t wch;
1878+
wint_t rtn;
18791879

18801880
Py_BEGIN_ALLOW_THREADS
18811881
if (!group_right_1) {
1882-
ct = wget_wch(self->win, &wch);
1882+
ct = wget_wch(self->win, &rtn);
18831883
}
18841884
else {
1885-
ct = mvwget_wch(self->win, y, x, &wch);
1885+
ct = mvwget_wch(self->win, y, x, &rtn);
18861886
}
18871887
Py_END_ALLOW_THREADS
18881888

18891889
if (ct == ERR) {
18901890
if (PyErr_CheckSignals())
18911891
return NULL;
1892+
18921893
/* get_wch() returns ERR in nodelay mode */
18931894
cursesmodule_state *state = get_cursesmodule_state_by_win(self);
18941895
PyErr_SetString(state->error, "no input");
@@ -1897,9 +1898,9 @@ _curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
18971898
return NULL;
18981899
}
18991900
if (ct == KEY_CODE_YES)
1900-
return PyLong_FromLong(wch);
1901+
return PyLong_FromLong(rtn);
19011902
else
1902-
return PyUnicode_FromOrdinal(wch);
1903+
return PyUnicode_FromOrdinal(rtn);
19031904
}
19041905
#endif
19051906

@@ -2017,7 +2018,6 @@ _curses_window_hline_impl(PyCursesWindowObject *self, int group_left_1,
20172018

20182019
if (!PyCurses_ConvertToChtype(self, ch, &ch_))
20192020
return NULL;
2020-
20212021
if (group_left_1) {
20222022
if (wmove(self->win, y, x) == ERR) {
20232023
PyCursesSetError_ForWin(self, "wmove");
@@ -2261,7 +2261,7 @@ _curses_window_insstr_impl(PyCursesWindowObject *self, int group_left_1,
22612261
Py_DECREF(bytesobj);
22622262
}
22632263
if (use_attr)
2264-
(void)wattrset(self->win, attr_old);
2264+
(void)wattrset(self->win,attr_old);
22652265
return PyCursesCheckERR_ForWin_From(self, rtn,
22662266
simple_funcname,
22672267
curses_funcname);
@@ -2356,7 +2356,7 @@ _curses_window_insnstr_impl(PyCursesWindowObject *self, int group_left_1,
23562356
Py_DECREF(bytesobj);
23572357
}
23582358
if (use_attr)
2359-
(void)wattrset(self->win, attr_old);
2359+
(void)wattrset(self->win,attr_old);
23602360
return PyCursesCheckERR_ForWin_From(self, rtn,
23612361
simple_funcname,
23622362
curses_funcname);
@@ -3450,7 +3450,7 @@ _curses_getmouse_impl(PyObject *module)
34503450

34513451
PyCursesStatefulInitialised(module);
34523452

3453-
rtn = getmouse(&event);
3453+
rtn = getmouse( &event );
34543454
if (rtn == ERR) {
34553455
PyCursesSetError(module, "getmouse");
34563456
return NULL;
@@ -3877,20 +3877,20 @@ _curses_setupterm_impl(PyObject *module, const char *term, int fd)
38773877
}
38783878

38793879
if (!curses_setupterm_called && setupterm((char *)term, fd, &err) == ERR) {
3880-
const char *error_message;
3880+
const char *s;
38813881

38823882
if (err == 0) {
3883-
error_message = "setupterm: could not find terminal";
3883+
s = "setupterm: could not find terminal";
38843884
}
38853885
else if (err == -1) {
3886-
error_message = "setupterm: could not find terminfo database";
3886+
s = "setupterm: could not find terminfo database";
38873887
}
38883888
else {
3889-
error_message = "setupterm: unknown error";
3889+
s = "setupterm: unknown error";
38903890
}
38913891

38923892
cursesmodule_state *state = get_cursesmodule_state(module);
3893-
PyErr_SetString(state->error, error_message);
3893+
PyErr_SetString(state->error, s);
38943894
PyCursesError_SetImplementation(state, "setupterm");
38953895
return NULL;
38963896
}
@@ -4251,7 +4251,7 @@ _curses_newwin_impl(PyObject *module, int nlines, int ncols,
42514251

42524252
PyCursesStatefulInitialised(module);
42534253

4254-
win = newwin(nlines, ncols, begin_y, begin_x);
4254+
win = newwin(nlines,ncols,begin_y,begin_x);
42554255
if (win == NULL) {
42564256
cursesmodule_state *state = get_cursesmodule_state(module);
42574257
PyErr_SetString(state->error, catchall_NULL);
@@ -4849,10 +4849,12 @@ _curses_tparm_impl(PyObject *module, const char *str, int i1, int i2, int i3,
48494849
int i4, int i5, int i6, int i7, int i8, int i9)
48504850
/*[clinic end generated code: output=599f62b615c667ff input=5e30b15786f032aa]*/
48514851
{
4852+
char* result = NULL;
4853+
48524854
PyCursesStatefulSetupTermCalled(module);
48534855

4854-
const char *result = tparm((char *)str, i1, i2, i3, i4, i5, i6, i7, i8, i9);
4855-
if (result == NULL) {
4856+
result = tparm((char *)str,i1,i2,i3,i4,i5,i6,i7,i8,i9);
4857+
if (!result) {
48564858
cursesmodule_state *state = get_cursesmodule_state(module);
48574859
PyErr_Format(state->error, CURSES_ERROR_NULL_FORMAT, "tparm");
48584860
PyCursesError_SetImplementation(state, "tparm");

0 commit comments

Comments
 (0)