Prettier generated python C/C++ code

This commit is contained in:
William S Fulton 2024-09-28 10:45:16 +01:00
parent 98e3b6c44e
commit ad036e98d7
2 changed files with 9 additions and 9 deletions

View File

@ -358,9 +358,9 @@ swig_varlink_type(void) {
0, /* tp_itemsize */
(destructor) swig_varlink_dealloc, /* tp_dealloc */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
(printfunc)0, /* tp_print */
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
(Py_ssize_t)0, /* tp_vectorcall_offset */
#endif
(getattrfunc) swig_varlink_getattr, /* tp_getattr */
(setattrfunc) swig_varlink_setattr, /* tp_setattr */
@ -971,9 +971,9 @@ SwigPyObject_TypeOnce(void) {
0, /* tp_itemsize */
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
(printfunc)0, /* tp_print */
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
(Py_ssize_t)0, /* tp_vectorcall_offset */
#endif
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
@ -1193,9 +1193,9 @@ SwigPyPacked_TypeOnce(void) {
0, /* tp_itemsize */
(destructor)SwigPyPacked_dealloc, /* tp_dealloc */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
(printfunc)0, /* tp_print */
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
(Py_ssize_t)0, /* tp_vectorcall_offset */
#endif
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */

View File

@ -146,7 +146,7 @@ static void printSlot(File *f, String *slotval, const char *slotname, const char
if (functype && Strcmp(slotval, "0") == 0)
slotval = slotval_override = NewStringf("(%s) %s", functype, slotval);
int len = Len(slotval);
int fieldwidth = len > 41 ? (len > 61 ? 0 : 61 - len) : 41 - len;
int fieldwidth = len >= 39 ? 1 : 39 - len;
Printf(f, " %s,%*s/* %s */\n", slotval, fieldwidth, "", slotname);
Delete(slotval_override);
}
@ -155,8 +155,8 @@ static void printSlot2(File *f, String *slotval, const char *slotname, const cha
String *slotval_override = 0;
if (functype && Strcmp(slotval, "0") == 0)
slotval = slotval_override = NewStringf("(%s) %s", functype, slotval);
int len = Len(slotval);
int fieldwidth = len > 41 ? (len > 61 ? 0 : 61 - len) : 41 - len;
int len = Len(slotname);
int fieldwidth = len >= 30 ? 1 : 30 - len;
Printf(f, " { Py_%s,%*s(void *)%s },\n", slotname, fieldwidth, "", slotval);
Delete(slotval_override);
}