Skip to content

Commit c0e2074

Browse files
committed
PHPC-1442: Remove PHONGO_ZEND_OBJECT_* macros
1 parent 0a97306 commit c0e2074

File tree

1 file changed

+87
-126
lines changed

1 file changed

+87
-126
lines changed

php_phongo_structs.h

Lines changed: 87 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,30 @@
2121

2222
#include "php_bson.h"
2323

24-
#define PHONGO_ZEND_OBJECT_PRE
25-
#define PHONGO_ZEND_OBJECT_POST zend_object std;
26-
#define PHONGO_STRUCT_ZVAL zval
27-
2824
typedef struct {
29-
PHONGO_ZEND_OBJECT_PRE
3025
mongoc_bulk_operation_t* bulk;
3126
size_t num_ops;
3227
bool ordered;
3328
int bypass;
3429
char* database;
3530
char* collection;
3631
bool executed;
37-
PHONGO_ZEND_OBJECT_POST
32+
zend_object std;
3833
} php_phongo_bulkwrite_t;
3934

4035
typedef struct {
41-
PHONGO_ZEND_OBJECT_PRE
4236
mongoc_client_encryption_t* client_encryption;
43-
PHONGO_ZEND_OBJECT_POST
37+
zend_object std;
4438
} php_phongo_clientencryption_t;
4539

4640
typedef struct {
47-
PHONGO_ZEND_OBJECT_PRE
48-
bson_t* bson;
49-
uint32_t max_await_time_ms;
50-
uint32_t batch_size;
51-
PHONGO_ZEND_OBJECT_POST
41+
bson_t* bson;
42+
uint32_t max_await_time_ms;
43+
uint32_t batch_size;
44+
zend_object std;
5245
} php_phongo_command_t;
5346

5447
typedef struct {
55-
PHONGO_ZEND_OBJECT_PRE
5648
mongoc_cursor_t* cursor;
5749
mongoc_client_t* client;
5850
int created_by_pid;
@@ -63,242 +55,211 @@ typedef struct {
6355
long current;
6456
char* database;
6557
char* collection;
66-
PHONGO_STRUCT_ZVAL query;
67-
PHONGO_STRUCT_ZVAL command;
68-
PHONGO_STRUCT_ZVAL read_preference;
69-
PHONGO_STRUCT_ZVAL session;
70-
PHONGO_ZEND_OBJECT_POST
58+
zval query;
59+
zval command;
60+
zval read_preference;
61+
zval session;
62+
zend_object std;
7163
} php_phongo_cursor_t;
7264

7365
typedef struct {
74-
PHONGO_ZEND_OBJECT_PRE
75-
int64_t id;
76-
PHONGO_ZEND_OBJECT_POST
66+
int64_t id;
67+
zend_object std;
7768
} php_phongo_cursorid_t;
7869

7970
typedef struct {
80-
PHONGO_ZEND_OBJECT_PRE
8171
mongoc_client_t* client;
8272
int created_by_pid;
8373
char* client_hash;
8474
size_t client_hash_len;
85-
PHONGO_ZEND_OBJECT_POST
75+
zend_object std;
8676
} php_phongo_manager_t;
8777

8878
typedef struct {
89-
PHONGO_ZEND_OBJECT_PRE
9079
bson_t* filter;
9180
bson_t* opts;
9281
mongoc_read_concern_t* read_concern;
9382
uint32_t max_await_time_ms;
94-
PHONGO_ZEND_OBJECT_POST
83+
zend_object std;
9584
} php_phongo_query_t;
9685

9786
typedef struct {
98-
PHONGO_ZEND_OBJECT_PRE
9987
mongoc_read_concern_t* read_concern;
10088
HashTable* properties;
101-
PHONGO_ZEND_OBJECT_POST
89+
zend_object std;
10290
} php_phongo_readconcern_t;
10391

10492
typedef struct {
105-
PHONGO_ZEND_OBJECT_PRE
10693
mongoc_read_prefs_t* read_preference;
10794
HashTable* properties;
108-
PHONGO_ZEND_OBJECT_POST
95+
zend_object std;
10996
} php_phongo_readpreference_t;
11097

11198
typedef struct {
112-
PHONGO_ZEND_OBJECT_PRE
11399
mongoc_client_t* client;
114100
int created_by_pid;
115101
uint32_t server_id;
116-
PHONGO_ZEND_OBJECT_POST
102+
zend_object std;
117103
} php_phongo_server_t;
118104

119105
typedef struct {
120-
PHONGO_ZEND_OBJECT_PRE
121106
mongoc_client_session_t* client_session;
122107
mongoc_client_t* client;
123108
int created_by_pid;
124-
PHONGO_ZEND_OBJECT_POST
109+
zend_object std;
125110
} php_phongo_session_t;
126111

127112
typedef struct {
128-
PHONGO_ZEND_OBJECT_PRE
129113
HashTable* properties;
130114
mongoc_write_concern_t* write_concern;
131-
PHONGO_ZEND_OBJECT_POST
115+
zend_object std;
132116
} php_phongo_writeconcern_t;
133117

134118
typedef struct {
135-
PHONGO_ZEND_OBJECT_PRE
136-
int code;
137-
char* message;
138-
PHONGO_STRUCT_ZVAL info;
139-
PHONGO_ZEND_OBJECT_POST
119+
int code;
120+
char* message;
121+
zval info;
122+
zend_object std;
140123
} php_phongo_writeconcernerror_t;
141124

142125
typedef struct {
143-
PHONGO_ZEND_OBJECT_PRE
144-
int code;
145-
char* message;
146-
PHONGO_STRUCT_ZVAL info;
147-
uint32_t index;
148-
PHONGO_ZEND_OBJECT_POST
126+
int code;
127+
char* message;
128+
zval info;
129+
uint32_t index;
130+
zend_object std;
149131
} php_phongo_writeerror_t;
150132

151133
typedef struct {
152-
PHONGO_ZEND_OBJECT_PRE
153134
mongoc_write_concern_t* write_concern;
154135
bson_t* reply;
155136
mongoc_client_t* client;
156137
uint32_t server_id;
157-
PHONGO_ZEND_OBJECT_POST
138+
zend_object std;
158139
} php_phongo_writeresult_t;
159140

160141
typedef struct {
161-
PHONGO_ZEND_OBJECT_PRE
162-
char* data;
163-
int data_len;
164-
uint8_t type;
165-
HashTable* properties;
166-
PHONGO_ZEND_OBJECT_POST
142+
char* data;
143+
int data_len;
144+
uint8_t type;
145+
HashTable* properties;
146+
zend_object std;
167147
} php_phongo_binary_t;
168148

169149
typedef struct {
170-
PHONGO_ZEND_OBJECT_PRE
171-
char* ref;
172-
size_t ref_len;
173-
char id[25];
174-
HashTable* properties;
175-
PHONGO_ZEND_OBJECT_POST
150+
char* ref;
151+
size_t ref_len;
152+
char id[25];
153+
HashTable* properties;
154+
zend_object std;
176155
} php_phongo_dbpointer_t;
177156

178157
typedef struct {
179-
PHONGO_ZEND_OBJECT_PRE
180158
bool initialized;
181159
bson_decimal128_t decimal;
182160
HashTable* properties;
183-
PHONGO_ZEND_OBJECT_POST
161+
zend_object std;
184162
} php_phongo_decimal128_t;
185163

186164
typedef struct {
187-
PHONGO_ZEND_OBJECT_PRE
188-
bool initialized;
189-
int64_t integer;
190-
HashTable* properties;
191-
PHONGO_ZEND_OBJECT_POST
165+
bool initialized;
166+
int64_t integer;
167+
HashTable* properties;
168+
zend_object std;
192169
} php_phongo_int64_t;
193170

194171
typedef struct {
195-
PHONGO_ZEND_OBJECT_PRE
196-
char* code;
197-
size_t code_len;
198-
bson_t* scope;
199-
HashTable* properties;
200-
PHONGO_ZEND_OBJECT_POST
172+
char* code;
173+
size_t code_len;
174+
bson_t* scope;
175+
HashTable* properties;
176+
zend_object std;
201177
} php_phongo_javascript_t;
202178

203179
typedef struct {
204-
PHONGO_ZEND_OBJECT_PRE
205-
PHONGO_ZEND_OBJECT_POST
180+
zend_object std;
206181
} php_phongo_maxkey_t;
207182

208183
typedef struct {
209-
PHONGO_ZEND_OBJECT_PRE
210-
PHONGO_ZEND_OBJECT_POST
184+
zend_object std;
211185
} php_phongo_minkey_t;
212186

213187
typedef struct {
214-
PHONGO_ZEND_OBJECT_PRE
215-
bool initialized;
216-
char oid[25];
217-
HashTable* properties;
218-
PHONGO_ZEND_OBJECT_POST
188+
bool initialized;
189+
char oid[25];
190+
HashTable* properties;
191+
zend_object std;
219192
} php_phongo_objectid_t;
220193

221194
typedef struct {
222-
PHONGO_ZEND_OBJECT_PRE
223-
char* pattern;
224-
int pattern_len;
225-
char* flags;
226-
int flags_len;
227-
HashTable* properties;
228-
PHONGO_ZEND_OBJECT_POST
195+
char* pattern;
196+
int pattern_len;
197+
char* flags;
198+
int flags_len;
199+
HashTable* properties;
200+
zend_object std;
229201
} php_phongo_regex_t;
230202

231203
typedef struct {
232-
PHONGO_ZEND_OBJECT_PRE
233-
char* symbol;
234-
size_t symbol_len;
235-
HashTable* properties;
236-
PHONGO_ZEND_OBJECT_POST
204+
char* symbol;
205+
size_t symbol_len;
206+
HashTable* properties;
207+
zend_object std;
237208
} php_phongo_symbol_t;
238209

239210
typedef struct {
240-
PHONGO_ZEND_OBJECT_PRE
241-
bool initialized;
242-
uint32_t increment;
243-
uint32_t timestamp;
244-
HashTable* properties;
245-
PHONGO_ZEND_OBJECT_POST
211+
bool initialized;
212+
uint32_t increment;
213+
uint32_t timestamp;
214+
HashTable* properties;
215+
zend_object std;
246216
} php_phongo_timestamp_t;
247217

248218
typedef struct {
249-
PHONGO_ZEND_OBJECT_PRE
250-
PHONGO_ZEND_OBJECT_POST
219+
zend_object std;
251220
} php_phongo_undefined_t;
252221

253222
typedef struct {
254-
PHONGO_ZEND_OBJECT_PRE
255-
bool initialized;
256-
int64_t milliseconds;
257-
HashTable* properties;
258-
PHONGO_ZEND_OBJECT_POST
223+
bool initialized;
224+
int64_t milliseconds;
225+
HashTable* properties;
226+
zend_object std;
259227
} php_phongo_utcdatetime_t;
260228

261229
typedef struct {
262-
PHONGO_ZEND_OBJECT_PRE
263-
mongoc_client_t* client;
264-
char* command_name;
265-
uint32_t server_id;
266-
uint64_t operation_id;
267-
uint64_t request_id;
268-
uint64_t duration_micros;
269-
bson_t* reply;
270-
PHONGO_STRUCT_ZVAL z_error;
271-
PHONGO_ZEND_OBJECT_POST
230+
mongoc_client_t* client;
231+
char* command_name;
232+
uint32_t server_id;
233+
uint64_t operation_id;
234+
uint64_t request_id;
235+
uint64_t duration_micros;
236+
bson_t* reply;
237+
zval z_error;
238+
zend_object std;
272239
} php_phongo_commandfailedevent_t;
273240

274241
typedef struct {
275-
PHONGO_ZEND_OBJECT_PRE
276242
mongoc_client_t* client;
277243
char* command_name;
278244
uint32_t server_id;
279245
uint64_t operation_id;
280246
uint64_t request_id;
281247
bson_t* command;
282248
char* database_name;
283-
PHONGO_ZEND_OBJECT_POST
249+
zend_object std;
284250
} php_phongo_commandstartedevent_t;
285251

286252
typedef struct {
287-
PHONGO_ZEND_OBJECT_PRE
288253
mongoc_client_t* client;
289254
char* command_name;
290255
uint32_t server_id;
291256
uint64_t operation_id;
292257
uint64_t request_id;
293258
uint64_t duration_micros;
294259
bson_t* reply;
295-
PHONGO_ZEND_OBJECT_POST
260+
zend_object std;
296261
} php_phongo_commandsucceededevent_t;
297262

298-
#undef PHONGO_ZEND_OBJECT_PRE
299-
#undef PHONGO_ZEND_OBJECT_POST
300-
#undef PHONGO_STRUCT_ZVAL
301-
302263
#endif /* PHONGO_STRUCTS */
303264

304265
/*

0 commit comments

Comments
 (0)