Commit fd669baa authored by Christian Heimes's avatar Christian Heimes

Use PyModule_AddIntMacro() in signal module

The signal module was using old-style module initialization with
potential NULL dereferencing.

CID 1295026
parent 53bea131
...@@ -1266,210 +1266,169 @@ PyInit__signal(void) ...@@ -1266,210 +1266,169 @@ PyInit__signal(void)
} }
#ifdef SIGHUP #ifdef SIGHUP
x = PyLong_FromLong(SIGHUP); if (PyModule_AddIntMacro(m, SIGHUP))
PyDict_SetItemString(d, "SIGHUP", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGINT #ifdef SIGINT
x = PyLong_FromLong(SIGINT); if (PyModule_AddIntMacro(m, SIGINT))
PyDict_SetItemString(d, "SIGINT", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGBREAK #ifdef SIGBREAK
x = PyLong_FromLong(SIGBREAK); if (PyModule_AddIntMacro(m, SIGBREAK))
PyDict_SetItemString(d, "SIGBREAK", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGQUIT #ifdef SIGQUIT
x = PyLong_FromLong(SIGQUIT); if (PyModule_AddIntMacro(m, SIGQUIT))
PyDict_SetItemString(d, "SIGQUIT", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGILL #ifdef SIGILL
x = PyLong_FromLong(SIGILL); if (PyModule_AddIntMacro(m, SIGILL))
PyDict_SetItemString(d, "SIGILL", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGTRAP #ifdef SIGTRAP
x = PyLong_FromLong(SIGTRAP); if (PyModule_AddIntMacro(m, SIGTRAP))
PyDict_SetItemString(d, "SIGTRAP", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGIOT #ifdef SIGIOT
x = PyLong_FromLong(SIGIOT); if (PyModule_AddIntMacro(m, SIGIOT))
PyDict_SetItemString(d, "SIGIOT", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGABRT #ifdef SIGABRT
x = PyLong_FromLong(SIGABRT); if (PyModule_AddIntMacro(m, SIGABRT))
PyDict_SetItemString(d, "SIGABRT", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGEMT #ifdef SIGEMT
x = PyLong_FromLong(SIGEMT); if (PyModule_AddIntMacro(m, SIGEMT))
PyDict_SetItemString(d, "SIGEMT", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGFPE #ifdef SIGFPE
x = PyLong_FromLong(SIGFPE); if (PyModule_AddIntMacro(m, SIGFPE))
PyDict_SetItemString(d, "SIGFPE", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGKILL #ifdef SIGKILL
x = PyLong_FromLong(SIGKILL); if (PyModule_AddIntMacro(m, SIGKILL))
PyDict_SetItemString(d, "SIGKILL", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGBUS #ifdef SIGBUS
x = PyLong_FromLong(SIGBUS); if (PyModule_AddIntMacro(m, SIGBUS))
PyDict_SetItemString(d, "SIGBUS", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGSEGV #ifdef SIGSEGV
x = PyLong_FromLong(SIGSEGV); if (PyModule_AddIntMacro(m, SIGSEGV))
PyDict_SetItemString(d, "SIGSEGV", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGSYS #ifdef SIGSYS
x = PyLong_FromLong(SIGSYS); if (PyModule_AddIntMacro(m, SIGSYS))
PyDict_SetItemString(d, "SIGSYS", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGPIPE #ifdef SIGPIPE
x = PyLong_FromLong(SIGPIPE); if (PyModule_AddIntMacro(m, SIGPIPE))
PyDict_SetItemString(d, "SIGPIPE", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGALRM #ifdef SIGALRM
x = PyLong_FromLong(SIGALRM); if (PyModule_AddIntMacro(m, SIGALRM))
PyDict_SetItemString(d, "SIGALRM", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGTERM #ifdef SIGTERM
x = PyLong_FromLong(SIGTERM); if (PyModule_AddIntMacro(m, SIGTERM))
PyDict_SetItemString(d, "SIGTERM", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGUSR1 #ifdef SIGUSR1
x = PyLong_FromLong(SIGUSR1); if (PyModule_AddIntMacro(m, SIGUSR1))
PyDict_SetItemString(d, "SIGUSR1", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGUSR2 #ifdef SIGUSR2
x = PyLong_FromLong(SIGUSR2); if (PyModule_AddIntMacro(m, SIGUSR2))
PyDict_SetItemString(d, "SIGUSR2", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGCLD #ifdef SIGCLD
x = PyLong_FromLong(SIGCLD); if (PyModule_AddIntMacro(m, SIGCLD))
PyDict_SetItemString(d, "SIGCLD", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGCHLD #ifdef SIGCHLD
x = PyLong_FromLong(SIGCHLD); if (PyModule_AddIntMacro(m, SIGCHLD))
PyDict_SetItemString(d, "SIGCHLD", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGPWR #ifdef SIGPWR
x = PyLong_FromLong(SIGPWR); if (PyModule_AddIntMacro(m, SIGPWR))
PyDict_SetItemString(d, "SIGPWR", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGIO #ifdef SIGIO
x = PyLong_FromLong(SIGIO); if (PyModule_AddIntMacro(m, SIGIO))
PyDict_SetItemString(d, "SIGIO", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGURG #ifdef SIGURG
x = PyLong_FromLong(SIGURG); if (PyModule_AddIntMacro(m, SIGURG))
PyDict_SetItemString(d, "SIGURG", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGWINCH #ifdef SIGWINCH
x = PyLong_FromLong(SIGWINCH); if (PyModule_AddIntMacro(m, SIGWINCH))
PyDict_SetItemString(d, "SIGWINCH", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGPOLL #ifdef SIGPOLL
x = PyLong_FromLong(SIGPOLL); if (PyModule_AddIntMacro(m, SIGPOLL))
PyDict_SetItemString(d, "SIGPOLL", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGSTOP #ifdef SIGSTOP
x = PyLong_FromLong(SIGSTOP); if (PyModule_AddIntMacro(m, SIGSTOP))
PyDict_SetItemString(d, "SIGSTOP", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGTSTP #ifdef SIGTSTP
x = PyLong_FromLong(SIGTSTP); if (PyModule_AddIntMacro(m, SIGTSTP))
PyDict_SetItemString(d, "SIGTSTP", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGCONT #ifdef SIGCONT
x = PyLong_FromLong(SIGCONT); if (PyModule_AddIntMacro(m, SIGCONT))
PyDict_SetItemString(d, "SIGCONT", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGTTIN #ifdef SIGTTIN
x = PyLong_FromLong(SIGTTIN); if (PyModule_AddIntMacro(m, SIGTTIN))
PyDict_SetItemString(d, "SIGTTIN", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGTTOU #ifdef SIGTTOU
x = PyLong_FromLong(SIGTTOU); if (PyModule_AddIntMacro(m, SIGTTOU))
PyDict_SetItemString(d, "SIGTTOU", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGVTALRM #ifdef SIGVTALRM
x = PyLong_FromLong(SIGVTALRM); if (PyModule_AddIntMacro(m, SIGVTALRM))
PyDict_SetItemString(d, "SIGVTALRM", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGPROF #ifdef SIGPROF
x = PyLong_FromLong(SIGPROF); if (PyModule_AddIntMacro(m, SIGPROF))
PyDict_SetItemString(d, "SIGPROF", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGXCPU #ifdef SIGXCPU
x = PyLong_FromLong(SIGXCPU); if (PyModule_AddIntMacro(m, SIGXCPU))
PyDict_SetItemString(d, "SIGXCPU", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGXFSZ #ifdef SIGXFSZ
x = PyLong_FromLong(SIGXFSZ); if (PyModule_AddIntMacro(m, SIGXFSZ))
PyDict_SetItemString(d, "SIGXFSZ", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGRTMIN #ifdef SIGRTMIN
x = PyLong_FromLong(SIGRTMIN); if (PyModule_AddIntMacro(m, SIGRTMIN))
PyDict_SetItemString(d, "SIGRTMIN", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGRTMAX #ifdef SIGRTMAX
x = PyLong_FromLong(SIGRTMAX); if (PyModule_AddIntMacro(m, SIGRTMAX))
PyDict_SetItemString(d, "SIGRTMAX", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef SIGINFO #ifdef SIGINFO
x = PyLong_FromLong(SIGINFO); if (PyModule_AddIntMacro(m, SIGINFO))
PyDict_SetItemString(d, "SIGINFO", x); goto finally;
Py_XDECREF(x);
#endif #endif
#ifdef ITIMER_REAL #ifdef ITIMER_REAL
x = PyLong_FromLong(ITIMER_REAL); if (PyModule_AddIntMacro(m, ITIMER_REAL))
PyDict_SetItemString(d, "ITIMER_REAL", x); goto finally;
Py_DECREF(x);
#endif #endif
#ifdef ITIMER_VIRTUAL #ifdef ITIMER_VIRTUAL
x = PyLong_FromLong(ITIMER_VIRTUAL); if (PyModule_AddIntMacro(m, ITIMER_VIRTUAL))
PyDict_SetItemString(d, "ITIMER_VIRTUAL", x); goto finally;
Py_DECREF(x);
#endif #endif
#ifdef ITIMER_PROF #ifdef ITIMER_PROF
x = PyLong_FromLong(ITIMER_PROF); if (PyModule_AddIntMacro(m, ITIMER_PROF))
PyDict_SetItemString(d, "ITIMER_PROF", x); goto finally;
Py_DECREF(x);
#endif #endif
#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER) #if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
...@@ -1480,15 +1439,13 @@ PyInit__signal(void) ...@@ -1480,15 +1439,13 @@ PyInit__signal(void)
#endif #endif
#ifdef CTRL_C_EVENT #ifdef CTRL_C_EVENT
x = PyLong_FromLong(CTRL_C_EVENT); if (PyModule_AddIntMacro(m, CTRL_C_EVENT))
PyDict_SetItemString(d, "CTRL_C_EVENT", x); goto finally;
Py_DECREF(x);
#endif #endif
#ifdef CTRL_BREAK_EVENT #ifdef CTRL_BREAK_EVENT
x = PyLong_FromLong(CTRL_BREAK_EVENT); if (PyModule_AddIntMacro(m, CTRL_BREAK_EVENT))
PyDict_SetItemString(d, "CTRL_BREAK_EVENT", x); goto finally;
Py_DECREF(x);
#endif #endif
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment