Skip to content

Commit 63afc08

Browse files
committed
move cast macros to .c files
1 parent 1f54d11 commit 63afc08

File tree

11 files changed

+10
-12
lines changed

11 files changed

+10
-12
lines changed

Modules/_sqlite/blob.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "clinic/blob.c.h"
1010
#undef clinic_state
1111

12+
#define _pysqlite_Blob_CAST(op) ((pysqlite_Blob *)(op))
13+
1214
/*[clinic input]
1315
module _sqlite3
1416
class _sqlite3.Blob "pysqlite_Blob *" "clinic_state()->BlobType"

Modules/_sqlite/blob.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ typedef struct {
1818
PyObject *in_weakreflist;
1919
} pysqlite_Blob;
2020

21-
#define _pysqlite_Blob_CAST(op) ((pysqlite_Blob *)(op))
22-
2321
int pysqlite_blob_setup_types(PyObject *mod);
2422
void pysqlite_close_all_blobs(pysqlite_Connection *self);
2523

Modules/_sqlite/connection.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ sqlite3_int64_converter(PyObject *obj, sqlite3_int64 *result)
136136
#include "clinic/connection.c.h"
137137
#undef clinic_state
138138

139+
#define _pysqlite_Connection_CAST(op) ((pysqlite_Connection *)(op))
140+
139141
/*[clinic input]
140142
module _sqlite3
141143
class _sqlite3.Connection "pysqlite_Connection *" "clinic_state()->ConnectionType"

Modules/_sqlite/connection.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ typedef struct
105105
PyObject* NotSupportedError;
106106
} pysqlite_Connection;
107107

108-
#define _pysqlite_Connection_CAST(op) ((pysqlite_Connection *)(op))
109-
110108
int pysqlite_check_thread(pysqlite_Connection* self);
111109
int pysqlite_check_connection(pysqlite_Connection* con);
112110

Modules/_sqlite/cursor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ typedef enum {
4444
#include "clinic/cursor.c.h"
4545
#undef clinic_state
4646

47+
#define _pysqlite_Cursor_CAST(op) ((pysqlite_Cursor *)(op))
48+
4749
static inline int
4850
check_cursor_locked(pysqlite_Cursor *cur)
4951
{

Modules/_sqlite/cursor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ typedef struct
4747
PyObject* in_weakreflist; /* List of weak references */
4848
} pysqlite_Cursor;
4949

50-
#define _pysqlite_Cursor_CAST(op) ((pysqlite_Cursor *)(op))
51-
5250
int pysqlite_cursor_setup_types(PyObject *module);
5351

5452
#endif

Modules/_sqlite/prepare_protocol.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ typedef struct
3030
PyObject_HEAD
3131
} pysqlite_PrepareProtocol;
3232

33-
#define _pysqlite_PrepareProtocol_CAST(op) ((pysqlite_PrepareProtocol *)(op))
34-
3533
int pysqlite_prepare_protocol_setup_types(PyObject *module);
3634

3735
#endif

Modules/_sqlite/row.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "clinic/row.c.h"
3333
#undef clinic_state
3434

35+
#define _pysqlite_Row_CAST(op) ((pysqlite_Row *)(op))
36+
3537
/*[clinic input]
3638
module _sqlite3
3739
class _sqlite3.Row "pysqlite_Row *" "clinic_state()->RowType"

Modules/_sqlite/row.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ typedef struct _Row
3232
PyObject* description;
3333
} pysqlite_Row;
3434

35-
#define _pysqlite_Row_CAST(op) ((pysqlite_Row *)(op))
36-
3735
int pysqlite_row_setup_types(PyObject *module);
3836

3937
#endif

Modules/_sqlite/statement.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "statement.h"
2626
#include "util.h"
2727

28+
#define _pysqlite_Statement_CAST(op) ((pysqlite_Statement *)(op))
29+
2830
/* prototypes */
2931
static const char *lstrip_sql(const char *sql);
3032

0 commit comments

Comments
 (0)