aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/syslogmodule.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Modules/syslogmodule.c
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Modules/syslogmodule.c')
-rw-r--r--contrib/tools/python3/src/Modules/syslogmodule.c162
1 files changed, 81 insertions, 81 deletions
diff --git a/contrib/tools/python3/src/Modules/syslogmodule.c b/contrib/tools/python3/src/Modules/syslogmodule.c
index 2db71f7e6d..0f2fea15b3 100644
--- a/contrib/tools/python3/src/Modules/syslogmodule.c
+++ b/contrib/tools/python3/src/Modules/syslogmodule.c
@@ -50,7 +50,7 @@ Revision history:
/* syslog module */
#include "Python.h"
-#include "osdefs.h" // SEP
+#include "osdefs.h" // SEP
#include <syslog.h>
@@ -99,7 +99,7 @@ syslog_get_argv(void)
if (slash == -2)
return NULL;
if (slash != -1) {
- return PyUnicode_Substring(scriptobj, slash + 1, scriptlen);
+ return PyUnicode_Substring(scriptobj, slash + 1, scriptlen);
} else {
Py_INCREF(scriptobj);
return(scriptobj);
@@ -144,10 +144,10 @@ syslog_openlog(PyObject * self, PyObject * args, PyObject *kwds)
return NULL;
}
- if (PySys_Audit("syslog.openlog", "sll", ident, logopt, facility) < 0) {
- return NULL;
- }
-
+ if (PySys_Audit("syslog.openlog", "sll", ident, logopt, facility) < 0) {
+ return NULL;
+ }
+
openlog(ident, logopt, facility);
S_log_open = 1;
@@ -174,16 +174,16 @@ syslog_syslog(PyObject * self, PyObject * args)
if (message == NULL)
return NULL;
- if (PySys_Audit("syslog.syslog", "is", priority, message) < 0) {
- return NULL;
- }
-
+ if (PySys_Audit("syslog.syslog", "is", priority, message) < 0) {
+ return NULL;
+ }
+
/* if log is not opened, open it now */
if (!S_log_open) {
PyObject *openargs;
/* Continue even if PyTuple_New fails, because openlog(3) is optional.
- * So, we can still do logging in the unlikely event things are so hosed
+ * So, we can still do logging in the unlikely event things are so hosed
* that we can't do this tuple.
*/
if ((openargs = PyTuple_New(0))) {
@@ -202,9 +202,9 @@ syslog_syslog(PyObject * self, PyObject * args)
static PyObject *
syslog_closelog(PyObject *self, PyObject *unused)
{
- if (PySys_Audit("syslog.closelog", NULL) < 0) {
- return NULL;
- }
+ if (PySys_Audit("syslog.closelog", NULL) < 0) {
+ return NULL;
+ }
if (S_log_open) {
closelog();
Py_CLEAR(S_ident_o);
@@ -220,9 +220,9 @@ syslog_setlogmask(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri))
return NULL;
- if (PySys_Audit("syslog.setlogmask", "(O)", args ? args : Py_None) < 0) {
- return NULL;
- }
+ if (PySys_Audit("syslog.setlogmask", "(O)", args ? args : Py_None) < 0) {
+ return NULL;
+ }
omaskpri = setlogmask(maskpri);
return PyLong_FromLong(omaskpri);
}
@@ -252,7 +252,7 @@ syslog_log_upto(PyObject *self, PyObject *args)
/* List of functions defined in the module */
static PyMethodDef syslog_methods[] = {
- {"openlog", (PyCFunction)(void(*)(void)) syslog_openlog, METH_VARARGS | METH_KEYWORDS},
+ {"openlog", (PyCFunction)(void(*)(void)) syslog_openlog, METH_VARARGS | METH_KEYWORDS},
{"closelog", syslog_closelog, METH_NOARGS},
{"syslog", syslog_syslog, METH_VARARGS},
{"setlogmask", syslog_setlogmask, METH_VARARGS},
@@ -262,54 +262,54 @@ static PyMethodDef syslog_methods[] = {
};
-static int
-syslog_exec(PyObject *module)
+static int
+syslog_exec(PyObject *module)
{
-#define ADD_INT_MACRO(module, macro) \
- do { \
- if (PyModule_AddIntConstant(module, #macro, macro) < 0) { \
- return -1; \
- } \
- } while (0)
+#define ADD_INT_MACRO(module, macro) \
+ do { \
+ if (PyModule_AddIntConstant(module, #macro, macro) < 0) { \
+ return -1; \
+ } \
+ } while (0)
/* Priorities */
- ADD_INT_MACRO(module, LOG_EMERG);
- ADD_INT_MACRO(module, LOG_ALERT);
- ADD_INT_MACRO(module, LOG_CRIT);
- ADD_INT_MACRO(module, LOG_ERR);
- ADD_INT_MACRO(module, LOG_WARNING);
- ADD_INT_MACRO(module, LOG_NOTICE);
- ADD_INT_MACRO(module, LOG_INFO);
- ADD_INT_MACRO(module, LOG_DEBUG);
+ ADD_INT_MACRO(module, LOG_EMERG);
+ ADD_INT_MACRO(module, LOG_ALERT);
+ ADD_INT_MACRO(module, LOG_CRIT);
+ ADD_INT_MACRO(module, LOG_ERR);
+ ADD_INT_MACRO(module, LOG_WARNING);
+ ADD_INT_MACRO(module, LOG_NOTICE);
+ ADD_INT_MACRO(module, LOG_INFO);
+ ADD_INT_MACRO(module, LOG_DEBUG);
/* openlog() option flags */
- ADD_INT_MACRO(module, LOG_PID);
- ADD_INT_MACRO(module, LOG_CONS);
- ADD_INT_MACRO(module, LOG_NDELAY);
+ ADD_INT_MACRO(module, LOG_PID);
+ ADD_INT_MACRO(module, LOG_CONS);
+ ADD_INT_MACRO(module, LOG_NDELAY);
#ifdef LOG_ODELAY
- ADD_INT_MACRO(module, LOG_ODELAY);
+ ADD_INT_MACRO(module, LOG_ODELAY);
#endif
#ifdef LOG_NOWAIT
- ADD_INT_MACRO(module, LOG_NOWAIT);
+ ADD_INT_MACRO(module, LOG_NOWAIT);
#endif
#ifdef LOG_PERROR
- ADD_INT_MACRO(module, LOG_PERROR);
+ ADD_INT_MACRO(module, LOG_PERROR);
#endif
/* Facilities */
- ADD_INT_MACRO(module, LOG_KERN);
- ADD_INT_MACRO(module, LOG_USER);
- ADD_INT_MACRO(module, LOG_MAIL);
- ADD_INT_MACRO(module, LOG_DAEMON);
- ADD_INT_MACRO(module, LOG_AUTH);
- ADD_INT_MACRO(module, LOG_LPR);
- ADD_INT_MACRO(module, LOG_LOCAL0);
- ADD_INT_MACRO(module, LOG_LOCAL1);
- ADD_INT_MACRO(module, LOG_LOCAL2);
- ADD_INT_MACRO(module, LOG_LOCAL3);
- ADD_INT_MACRO(module, LOG_LOCAL4);
- ADD_INT_MACRO(module, LOG_LOCAL5);
- ADD_INT_MACRO(module, LOG_LOCAL6);
- ADD_INT_MACRO(module, LOG_LOCAL7);
+ ADD_INT_MACRO(module, LOG_KERN);
+ ADD_INT_MACRO(module, LOG_USER);
+ ADD_INT_MACRO(module, LOG_MAIL);
+ ADD_INT_MACRO(module, LOG_DAEMON);
+ ADD_INT_MACRO(module, LOG_AUTH);
+ ADD_INT_MACRO(module, LOG_LPR);
+ ADD_INT_MACRO(module, LOG_LOCAL0);
+ ADD_INT_MACRO(module, LOG_LOCAL1);
+ ADD_INT_MACRO(module, LOG_LOCAL2);
+ ADD_INT_MACRO(module, LOG_LOCAL3);
+ ADD_INT_MACRO(module, LOG_LOCAL4);
+ ADD_INT_MACRO(module, LOG_LOCAL5);
+ ADD_INT_MACRO(module, LOG_LOCAL6);
+ ADD_INT_MACRO(module, LOG_LOCAL7);
#ifndef LOG_SYSLOG
#define LOG_SYSLOG LOG_DAEMON
@@ -324,35 +324,35 @@ syslog_exec(PyObject *module)
#define LOG_CRON LOG_DAEMON
#endif
- ADD_INT_MACRO(module, LOG_SYSLOG);
- ADD_INT_MACRO(module, LOG_CRON);
- ADD_INT_MACRO(module, LOG_UUCP);
- ADD_INT_MACRO(module, LOG_NEWS);
+ ADD_INT_MACRO(module, LOG_SYSLOG);
+ ADD_INT_MACRO(module, LOG_CRON);
+ ADD_INT_MACRO(module, LOG_UUCP);
+ ADD_INT_MACRO(module, LOG_NEWS);
#ifdef LOG_AUTHPRIV
- ADD_INT_MACRO(module, LOG_AUTHPRIV);
+ ADD_INT_MACRO(module, LOG_AUTHPRIV);
#endif
- return 0;
+ return 0;
}
-
-static PyModuleDef_Slot syslog_slots[] = {
- {Py_mod_exec, syslog_exec},
- {0, NULL}
-};
-
-/* Initialization function for the module */
-
-static struct PyModuleDef syslogmodule = {
- PyModuleDef_HEAD_INIT,
- .m_name = "syslog",
- .m_size = 0,
- .m_methods = syslog_methods,
- .m_slots = syslog_slots,
-};
-
-PyMODINIT_FUNC
-PyInit_syslog(void)
-{
- return PyModuleDef_Init(&syslogmodule);
-} \ No newline at end of file
+
+static PyModuleDef_Slot syslog_slots[] = {
+ {Py_mod_exec, syslog_exec},
+ {0, NULL}
+};
+
+/* Initialization function for the module */
+
+static struct PyModuleDef syslogmodule = {
+ PyModuleDef_HEAD_INIT,
+ .m_name = "syslog",
+ .m_size = 0,
+ .m_methods = syslog_methods,
+ .m_slots = syslog_slots,
+};
+
+PyMODINIT_FUNC
+PyInit_syslog(void)
+{
+ return PyModuleDef_Init(&syslogmodule);
+} \ No newline at end of file