summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-03-20 00:16:34 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-03-20 01:48:05 +0000
commita2108593263dab4b2c647b673d3e7af6e0cf4809 (patch)
tree133ea43857baeb9b15f1d8e104a17ad272cd9319
parent73949cd1b8e508a1183e371b37fd30a6d402ae31 (diff)
downloadpsycopg2-a2108593263dab4b2c647b673d3e7af6e0cf4809.tar.gz
Notify and Xid objects and types renamed for consistency
They were the only objects starting with uppercase. My fault.
-rw-r--r--psycopg/connection.h6
-rw-r--r--psycopg/connection_int.c6
-rw-r--r--psycopg/connection_type.c6
-rw-r--r--psycopg/notify.h4
-rw-r--r--psycopg/notify_type.c34
-rw-r--r--psycopg/psycopgmodule.c16
-rw-r--r--psycopg/xid.h10
-rw-r--r--psycopg/xid_type.c64
8 files changed, 73 insertions, 73 deletions
diff --git a/psycopg/connection.h b/psycopg/connection.h
index 01cc6a4..4787e11 100644
--- a/psycopg/connection.h
+++ b/psycopg/connection.h
@@ -88,7 +88,7 @@ typedef struct {
2 that something horrible happened */
long int mark; /* number of commits/rollbacks done so far */
int status; /* status of the connection */
- XidObject *tpc_xid; /* Transaction ID in two-phase commit */
+ xidObject *tpc_xid; /* Transaction ID in two-phase commit */
long int async; /* 1 means the connection is async */
int protocol; /* protocol version */
@@ -151,9 +151,9 @@ HIDDEN int conn_set_autocommit(connectionObject *self, int value);
RAISES_NEG HIDDEN int conn_switch_isolation_level(connectionObject *self, int level);
RAISES_NEG HIDDEN int conn_set_client_encoding(connectionObject *self, const char *enc);
HIDDEN int conn_poll(connectionObject *self);
-RAISES_NEG HIDDEN int conn_tpc_begin(connectionObject *self, XidObject *xid);
+RAISES_NEG HIDDEN int conn_tpc_begin(connectionObject *self, xidObject *xid);
RAISES_NEG HIDDEN int conn_tpc_command(connectionObject *self,
- const char *cmd, XidObject *xid);
+ const char *cmd, xidObject *xid);
HIDDEN PyObject *conn_tpc_recover(connectionObject *self);
/* exception-raising macros */
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index 0e5cb3d..6cca1ce 100644
--- a/psycopg/connection_int.c
+++ b/psycopg/connection_int.c
@@ -183,7 +183,7 @@ conn_notifies_process(connectionObject *self)
if (!(channel = conn_text_from_chars(self, pgn->relname))) { goto error; }
if (!(payload = conn_text_from_chars(self, pgn->extra))) { goto error; }
- if (!(notify = PyObject_CallFunctionObjArgs((PyObject *)&NotifyType,
+ if (!(notify = PyObject_CallFunctionObjArgs((PyObject *)&notifyType,
pid, channel, payload, NULL))) {
goto error;
}
@@ -1216,7 +1216,7 @@ exit:
* until PREPARE. */
RAISES_NEG int
-conn_tpc_begin(connectionObject *self, XidObject *xid)
+conn_tpc_begin(connectionObject *self, xidObject *xid)
{
PGresult *pgres = NULL;
char *error = NULL;
@@ -1250,7 +1250,7 @@ conn_tpc_begin(connectionObject *self, XidObject *xid)
* for many commands and for recovered transactions. */
RAISES_NEG int
-conn_tpc_command(connectionObject *self, const char *cmd, XidObject *xid)
+conn_tpc_command(connectionObject *self, const char *cmd, xidObject *xid)
{
PGresult *pgres = NULL;
char *error = NULL;
diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c
index 63ac175..306f710 100644
--- a/psycopg/connection_type.c
+++ b/psycopg/connection_type.c
@@ -183,7 +183,7 @@ psyco_conn_xid(connectionObject *self, PyObject *args, PyObject *kwargs)
EXC_IF_CONN_CLOSED(self);
EXC_IF_TPC_NOT_SUPPORTED(self);
- return PyObject_Call((PyObject *)&XidType, args, kwargs);
+ return PyObject_Call((PyObject *)&xidType, args, kwargs);
}
@@ -194,7 +194,7 @@ static PyObject *
psyco_conn_tpc_begin(connectionObject *self, PyObject *args)
{
PyObject *rv = NULL;
- XidObject *xid = NULL;
+ xidObject *xid = NULL;
PyObject *oxid;
EXC_IF_CONN_CLOSED(self);
@@ -286,7 +286,7 @@ _psyco_conn_tpc_finish(connectionObject *self, PyObject *args,
_finish_f opc_f, char *tpc_cmd)
{
PyObject *oxid = NULL;
- XidObject *xid = NULL;
+ xidObject *xid = NULL;
PyObject *rv = NULL;
if (!PyArg_ParseTuple(args, "|O", &oxid)) { goto exit; }
diff --git a/psycopg/notify.h b/psycopg/notify.h
index 645fdd7..2f4c20f 100644
--- a/psycopg/notify.h
+++ b/psycopg/notify.h
@@ -26,7 +26,7 @@
#ifndef PSYCOPG_NOTIFY_H
#define PSYCOPG_NOTIFY_H 1
-extern HIDDEN PyTypeObject NotifyType;
+extern HIDDEN PyTypeObject notifyType;
typedef struct {
PyObject_HEAD
@@ -35,6 +35,6 @@ typedef struct {
PyObject *channel;
PyObject *payload;
-} NotifyObject;
+} notifyObject;
#endif /* PSYCOPG_NOTIFY_H */
diff --git a/psycopg/notify_type.c b/psycopg/notify_type.c
index f97a5af..03ff192 100644
--- a/psycopg/notify_type.c
+++ b/psycopg/notify_type.c
@@ -52,22 +52,22 @@ static const char payload_doc[] =
"of the server this member is always the empty string.";
static PyMemberDef notify_members[] = {
- { "pid", T_OBJECT, offsetof(NotifyObject, pid), READONLY, (char *)pid_doc },
- { "channel", T_OBJECT, offsetof(NotifyObject, channel), READONLY, (char *)channel_doc },
- { "payload", T_OBJECT, offsetof(NotifyObject, payload), READONLY, (char *)payload_doc },
+ { "pid", T_OBJECT, offsetof(notifyObject, pid), READONLY, (char *)pid_doc },
+ { "channel", T_OBJECT, offsetof(notifyObject, channel), READONLY, (char *)channel_doc },
+ { "payload", T_OBJECT, offsetof(notifyObject, payload), READONLY, (char *)payload_doc },
{ NULL }
};
static PyObject *
notify_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- NotifyObject *self = (NotifyObject *)type->tp_alloc(type, 0);
+ notifyObject *self = (notifyObject *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
static int
-notify_init(NotifyObject *self, PyObject *args, PyObject *kwargs)
+notify_init(notifyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"pid", "channel", "payload", NULL};
PyObject *pid = NULL, *channel = NULL, *payload = NULL;
@@ -97,7 +97,7 @@ notify_init(NotifyObject *self, PyObject *args, PyObject *kwargs)
}
static int
-notify_traverse(NotifyObject *self, visitproc visit, void *arg)
+notify_traverse(notifyObject *self, visitproc visit, void *arg)
{
Py_VISIT(self->pid);
Py_VISIT(self->channel);
@@ -106,7 +106,7 @@ notify_traverse(NotifyObject *self, visitproc visit, void *arg)
}
static void
-notify_dealloc(NotifyObject *self)
+notify_dealloc(notifyObject *self)
{
Py_CLEAR(self->pid);
Py_CLEAR(self->channel);
@@ -124,7 +124,7 @@ notify_del(PyObject *self)
/* Convert a notify into a 2 or 3 items tuple. */
static PyObject *
-notify_astuple(NotifyObject *self, int with_payload)
+notify_astuple(notifyObject *self, int with_payload)
{
PyObject *tself;
if (!(tself = PyTuple_New(with_payload ? 3 : 2))) { return NULL; }
@@ -162,15 +162,15 @@ notify_astuple(NotifyObject *self, int with_payload)
* the (pid, channel) pair is no more equivalent as dict key to the Notify.
*/
static PyObject *
-notify_richcompare(NotifyObject *self, PyObject *other, int op)
+notify_richcompare(notifyObject *self, PyObject *other, int op)
{
PyObject *rv = NULL;
PyObject *tself = NULL;
PyObject *tother = NULL;
- if (Py_TYPE(other) == &NotifyType) {
+ if (Py_TYPE(other) == &notifyType) {
if (!(tself = notify_astuple(self, 1))) { goto exit; }
- if (!(tother = notify_astuple((NotifyObject *)other, 1))) { goto exit; }
+ if (!(tother = notify_astuple((notifyObject *)other, 1))) { goto exit; }
rv = PyObject_RichCompare(tself, tother, op);
}
else if (PyTuple_Check(other)) {
@@ -190,7 +190,7 @@ exit:
static Py_hash_t
-notify_hash(NotifyObject *self)
+notify_hash(notifyObject *self)
{
Py_hash_t rv = -1L;
PyObject *tself = NULL;
@@ -207,7 +207,7 @@ exit:
static PyObject*
-notify_repr(NotifyObject *self)
+notify_repr(notifyObject *self)
{
PyObject *rv = NULL;
PyObject *format = NULL;
@@ -237,13 +237,13 @@ exit:
/* Notify can be accessed as a 2 items tuple for backward compatibility */
static Py_ssize_t
-notify_len(NotifyObject *self)
+notify_len(notifyObject *self)
{
return 2;
}
static PyObject *
-notify_getitem(NotifyObject *self, Py_ssize_t item)
+notify_getitem(notifyObject *self, Py_ssize_t item)
{
if (item < 0)
item += 2;
@@ -275,10 +275,10 @@ static PySequenceMethods notify_sequence = {
};
-PyTypeObject NotifyType = {
+PyTypeObject notifyType = {
PyVarObject_HEAD_INIT(NULL, 0)
"psycopg2.extensions.Notify",
- sizeof(NotifyObject),
+ sizeof(notifyObject),
0,
(destructor)notify_dealloc, /* tp_dealloc */
0, /*tp_print*/
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index 8a7539b..36984e5 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -780,8 +780,8 @@ INIT_MODULE(_psycopg)(void)
Py_TYPE(&asisType) = &PyType_Type;
Py_TYPE(&listType) = &PyType_Type;
Py_TYPE(&chunkType) = &PyType_Type;
- Py_TYPE(&NotifyType) = &PyType_Type;
- Py_TYPE(&XidType) = &PyType_Type;
+ Py_TYPE(&notifyType) = &PyType_Type;
+ Py_TYPE(&xidType) = &PyType_Type;
Py_TYPE(&errorType) = &PyType_Type;
Py_TYPE(&diagnosticsType) = &PyType_Type;
@@ -798,8 +798,8 @@ INIT_MODULE(_psycopg)(void)
if (PyType_Ready(&asisType) == -1) goto exit;
if (PyType_Ready(&listType) == -1) goto exit;
if (PyType_Ready(&chunkType) == -1) goto exit;
- if (PyType_Ready(&NotifyType) == -1) goto exit;
- if (PyType_Ready(&XidType) == -1) goto exit;
+ if (PyType_Ready(&notifyType) == -1) goto exit;
+ if (PyType_Ready(&xidType) == -1) goto exit;
errorType.tp_base = (PyTypeObject *)PyExc_StandardError;
if (PyType_Ready(&errorType) == -1) goto exit;
if (PyType_Ready(&diagnosticsType) == -1) goto exit;
@@ -890,8 +890,8 @@ INIT_MODULE(_psycopg)(void)
PyModule_AddObject(module, "connection", (PyObject*)&connectionType);
PyModule_AddObject(module, "cursor", (PyObject*)&cursorType);
PyModule_AddObject(module, "ISQLQuote", (PyObject*)&isqlquoteType);
- PyModule_AddObject(module, "Notify", (PyObject*)&NotifyType);
- PyModule_AddObject(module, "Xid", (PyObject*)&XidType);
+ PyModule_AddObject(module, "Notify", (PyObject*)&notifyType);
+ PyModule_AddObject(module, "Xid", (PyObject*)&xidType);
PyModule_AddObject(module, "Diagnostics", (PyObject*)&diagnosticsType);
#ifdef PSYCOPG_EXTENSIONS
PyModule_AddObject(module, "lobject", (PyObject*)&lobjectType);
@@ -935,8 +935,8 @@ INIT_MODULE(_psycopg)(void)
listType.tp_alloc = PyType_GenericAlloc;
chunkType.tp_alloc = PyType_GenericAlloc;
pydatetimeType.tp_alloc = PyType_GenericAlloc;
- NotifyType.tp_alloc = PyType_GenericAlloc;
- XidType.tp_alloc = PyType_GenericAlloc;
+ notifyType.tp_alloc = PyType_GenericAlloc;
+ xidType.tp_alloc = PyType_GenericAlloc;
errorType.tp_alloc = PyType_GenericAlloc;
diagnosticsType.tp_alloc = PyType_GenericAlloc;
diff --git a/psycopg/xid.h b/psycopg/xid.h
index e63db61..6f641be 100644
--- a/psycopg/xid.h
+++ b/psycopg/xid.h
@@ -27,7 +27,7 @@
#ifndef PSYCOPG_XID_H
#define PSYCOPG_XID_H 1
-extern HIDDEN PyTypeObject XidType;
+extern HIDDEN PyTypeObject xidType;
typedef struct {
PyObject_HEAD
@@ -41,11 +41,11 @@ typedef struct {
PyObject *prepared;
PyObject *owner;
PyObject *database;
-} XidObject;
+} xidObject;
-HIDDEN XidObject *xid_ensure(PyObject *oxid);
-HIDDEN XidObject *xid_from_string(PyObject *s);
-HIDDEN PyObject *xid_get_tid(XidObject *self);
+HIDDEN xidObject *xid_ensure(PyObject *oxid);
+HIDDEN xidObject *xid_from_string(PyObject *s);
+HIDDEN PyObject *xid_get_tid(xidObject *self);
HIDDEN PyObject *xid_recover(PyObject *conn);
#endif /* PSYCOPG_XID_H */
diff --git a/psycopg/xid_type.c b/psycopg/xid_type.c
index b38d914..2bc065b 100644
--- a/psycopg/xid_type.c
+++ b/psycopg/xid_type.c
@@ -67,21 +67,21 @@ static const char database_doc[] =
"Database the recovered transaction belongs to.";
static PyMemberDef xid_members[] = {
- { "format_id", T_OBJECT, offsetof(XidObject, format_id), READONLY, (char *)format_id_doc },
- { "gtrid", T_OBJECT, offsetof(XidObject, gtrid), READONLY, (char *)gtrid_doc },
- { "bqual", T_OBJECT, offsetof(XidObject, bqual), READONLY, (char *)bqual_doc },
- { "prepared", T_OBJECT, offsetof(XidObject, prepared), READONLY, (char *)prepared_doc },
- { "owner", T_OBJECT, offsetof(XidObject, owner), READONLY, (char *)owner_doc },
- { "database", T_OBJECT, offsetof(XidObject, database), READONLY, (char *)database_doc },
+ { "format_id", T_OBJECT, offsetof(xidObject, format_id), READONLY, (char *)format_id_doc },
+ { "gtrid", T_OBJECT, offsetof(xidObject, gtrid), READONLY, (char *)gtrid_doc },
+ { "bqual", T_OBJECT, offsetof(xidObject, bqual), READONLY, (char *)bqual_doc },
+ { "prepared", T_OBJECT, offsetof(xidObject, prepared), READONLY, (char *)prepared_doc },
+ { "owner", T_OBJECT, offsetof(xidObject, owner), READONLY, (char *)owner_doc },
+ { "database", T_OBJECT, offsetof(xidObject, database), READONLY, (char *)database_doc },
{ NULL }
};
static PyObject *
xid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- XidObject *self;
+ xidObject *self;
- if (!(self = (XidObject *)type->tp_alloc(type, 0))) { return NULL; }
+ if (!(self = (xidObject *)type->tp_alloc(type, 0))) { return NULL; }
Py_INCREF(Py_None);
self->format_id = Py_None;
@@ -100,7 +100,7 @@ xid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
}
static int
-xid_init(XidObject *self, PyObject *args, PyObject *kwargs)
+xid_init(xidObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"format_id", "gtrid", "bqual", NULL};
int format_id;
@@ -165,7 +165,7 @@ xid_init(XidObject *self, PyObject *args, PyObject *kwargs)
}
static int
-xid_traverse(XidObject *self, visitproc visit, void *arg)
+xid_traverse(xidObject *self, visitproc visit, void *arg)
{
Py_VISIT(self->format_id);
Py_VISIT(self->gtrid);
@@ -177,7 +177,7 @@ xid_traverse(XidObject *self, visitproc visit, void *arg)
}
static void
-xid_dealloc(XidObject *self)
+xid_dealloc(xidObject *self)
{
Py_CLEAR(self->format_id);
Py_CLEAR(self->gtrid);
@@ -196,13 +196,13 @@ xid_del(PyObject *self)
}
static Py_ssize_t
-xid_len(XidObject *self)
+xid_len(xidObject *self)
{
return 3;
}
static PyObject *
-xid_getitem(XidObject *self, Py_ssize_t item)
+xid_getitem(xidObject *self, Py_ssize_t item)
{
if (item < 0)
item += 3;
@@ -224,13 +224,13 @@ xid_getitem(XidObject *self, Py_ssize_t item)
}
static PyObject *
-xid_str(XidObject *self)
+xid_str(xidObject *self)
{
return xid_get_tid(self);
}
static PyObject *
-xid_repr(XidObject *self)
+xid_repr(xidObject *self)
{
PyObject *rv = NULL;
PyObject *format = NULL;
@@ -305,10 +305,10 @@ static struct PyMethodDef xid_methods[] = {
{NULL}
};
-PyTypeObject XidType = {
+PyTypeObject xidType = {
PyVarObject_HEAD_INIT(NULL, 0)
"psycopg2.extensions.Xid",
- sizeof(XidObject),
+ sizeof(xidObject),
0,
(destructor)xid_dealloc, /* tp_dealloc */
0, /*tp_print*/
@@ -376,13 +376,13 @@ PyTypeObject XidType = {
* or use a regular string they have found in PostgreSQL's pg_prepared_xacts
* in order to recover a transaction not generated by psycopg.
*/
-XidObject *xid_ensure(PyObject *oxid)
+xidObject *xid_ensure(PyObject *oxid)
{
- XidObject *rv = NULL;
+ xidObject *rv = NULL;
- if (PyObject_TypeCheck(oxid, &XidType)) {
+ if (PyObject_TypeCheck(oxid, &xidType)) {
Py_INCREF(oxid);
- rv = (XidObject *)oxid;
+ rv = (xidObject *)oxid;
}
else {
rv = xid_from_string(oxid);
@@ -445,7 +445,7 @@ _xid_decode64(PyObject *s)
* http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/xa/RecoveredXid.java?rev=1.2
*/
PyObject *
-xid_get_tid(XidObject *self)
+xid_get_tid(xidObject *self)
{
PyObject *rv = NULL;
PyObject *egtrid = NULL;
@@ -525,7 +525,7 @@ exit:
*
* Return NULL + exception if parsing failed. Else a new Xid object. */
-static XidObject *
+static xidObject *
_xid_parse_string(PyObject *str) {
PyObject *regex;
PyObject *m = NULL;
@@ -536,7 +536,7 @@ _xid_parse_string(PyObject *str) {
PyObject *ebqual = NULL;
PyObject *gtrid = NULL;
PyObject *bqual = NULL;
- XidObject *rv = NULL;
+ xidObject *rv = NULL;
/* check if the string is a possible XA triple with a regexp */
if (!(regex = _xid_get_parse_regex())) { goto exit; }
@@ -560,7 +560,7 @@ _xid_parse_string(PyObject *str) {
if (!(bqual = _xid_decode64(ebqual))) { goto exit; }
/* Try to build the xid with the parsed material */
- rv = (XidObject *)PyObject_CallFunctionObjArgs((PyObject *)&XidType,
+ rv = (xidObject *)PyObject_CallFunctionObjArgs((PyObject *)&xidType,
format_id, gtrid, bqual, NULL);
exit:
@@ -579,14 +579,14 @@ exit:
/* Return a new Xid object representing a transaction ID not conform to
* the XA specifications. */
-static XidObject *
+static xidObject *
_xid_unparsed_from_string(PyObject *str) {
- XidObject *xid = NULL;
- XidObject *rv = NULL;
+ xidObject *xid = NULL;
+ xidObject *rv = NULL;
PyObject *tmp;
/* fake args to work around the checks performed by the xid init */
- if (!(xid = (XidObject *)PyObject_CallFunction((PyObject *)&XidType,
+ if (!(xid = (xidObject *)PyObject_CallFunction((PyObject *)&xidType,
"iss", 0, "", ""))) {
goto exit;
}
@@ -624,9 +624,9 @@ exit:
* If the xid is in the format generated by Psycopg, unpack the tuple into
* the struct members. Otherwise generate an "unparsed" xid.
*/
-XidObject *
+xidObject *
xid_from_string(PyObject *str) {
- XidObject *rv;
+ xidObject *rv;
if (!(Bytes_Check(str) || PyUnicode_Check(str))) {
PyErr_SetString(PyExc_TypeError, "not a valid transaction id");
@@ -654,7 +654,7 @@ xid_recover(PyObject *conn)
PyObject *rv = NULL;
PyObject *curs = NULL;
PyObject *xids = NULL;
- XidObject *xid = NULL;
+ xidObject *xid = NULL;
PyObject *recs = NULL;
PyObject *rec = NULL;
PyObject *item = NULL;