Skip to content

Commit 3b4f176

Browse files
committed
clang-format
1 parent 263b20c commit 3b4f176

22 files changed

+326
-348
lines changed

php_phongo.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ static zend_class_entry* php_phongo_fetch_internal_class(const char* class_name,
155155
return NULL;
156156
}
157157

158-
159158
PHP_MINIT_FUNCTION(mongodb) /* {{{ */
160159
{
161160
bson_mem_vtable_t bson_mem_vtable = {

php_phongo.h

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,28 @@ ZEND_TSRMLS_CACHE_EXTERN()
6161
zend_object_handlers* phongo_get_std_object_handlers(void);
6262

6363
#define PHONGO_RETURN_PROPS(is_temp, props) \
64-
if (!(is_temp)) { \
65-
GC_ADDREF(props); \
66-
} \
64+
if (!(is_temp)) { \
65+
GC_ADDREF(props); \
66+
} \
6767
return props;
6868

69-
#define PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, size) \
70-
do { \
71-
if (!(intern)->php_properties) { \
72-
ALLOC_HASHTABLE((intern)->php_properties); \
69+
#define PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, size) \
70+
do { \
71+
if (!(intern)->php_properties) { \
72+
ALLOC_HASHTABLE((intern)->php_properties); \
7373
zend_hash_init((intern)->php_properties, 0, NULL, ZVAL_PTR_DTOR, 0); \
74-
} \
75-
if (is_temp) { \
76-
(props) = zend_array_dup((intern)->php_properties); \
77-
} else { \
78-
(props) = zend_array_dup((intern)->php_properties); \
79-
if ((intern)->properties) { \
80-
HashTable *__tmp = (intern)->properties; \
81-
(intern)->properties = NULL; \
82-
zend_hash_release(__tmp); \
83-
} \
84-
(intern)->properties = (props); \
85-
} \
74+
} \
75+
if (is_temp) { \
76+
(props) = zend_array_dup((intern)->php_properties); \
77+
} else { \
78+
(props) = zend_array_dup((intern)->php_properties); \
79+
if ((intern)->properties) { \
80+
HashTable* __tmp = (intern)->properties; \
81+
(intern)->properties = NULL; \
82+
zend_hash_release(__tmp); \
83+
} \
84+
(intern)->properties = (props); \
85+
} \
8686
} while (0)
8787

8888
#define PHONGO_GET_PROPERTY_HASH_FREE_PROPS(is_temp, props) \
@@ -92,87 +92,87 @@ zend_object_handlers* phongo_get_std_object_handlers(void);
9292
} \
9393
} while (0)
9494

95-
#define PHONGO_GET_PROPERTY_HANDLERS(_name, _intern_extractor) \
96-
PHONGO_GET_PROPERTY_HANDLERS_NO_GC(_name, _intern_extractor) \
97-
\
95+
#define PHONGO_GET_PROPERTY_HANDLERS(_name, _intern_extractor) \
96+
PHONGO_GET_PROPERTY_HANDLERS_NO_GC(_name, _intern_extractor) \
97+
\
9898
static HashTable* php_phongo_##_name##_get_gc(zend_object* zobj, zval** table, int* n) \
99-
{ \
100-
*table = NULL; \
101-
*n = 0; \
102-
return _intern_extractor(zobj)->php_properties; \
99+
{ \
100+
*table = NULL; \
101+
*n = 0; \
102+
return _intern_extractor(zobj)->php_properties; \
103103
}
104104

105-
#define PHONGO_GET_PROPERTY_HANDLERS_NO_GC(_name, _intern_extractor) \
106-
static zval* php_phongo_##_name##_read_property(zend_object *zobj, zend_string *member, int type, void **cache_slot, zval *rv) \
107-
{ \
108-
HashTable *props = _intern_extractor(zobj)->php_properties; \
109-
if (!props) { \
110-
ALLOC_HASHTABLE(props); \
111-
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
112-
_intern_extractor(zobj)->php_properties = props; \
113-
} \
114-
return zend_hash_find(props, member); \
115-
} \
116-
\
117-
static zval *php_phongo_##_name##_write_property(zend_object *zobj, zend_string *name, zval *value, void **cache_slot) \
118-
{ \
119-
Z_TRY_ADDREF_P(value); \
120-
HashTable *props = _intern_extractor(zobj)->php_properties; \
121-
if (!props) { \
122-
ALLOC_HASHTABLE(props); \
123-
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
124-
_intern_extractor(zobj)->php_properties = props; \
125-
} \
126-
return zend_hash_add_new(props, name, value); \
127-
} \
128-
static int php_phongo_##_name##_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot) \
129-
{ \
130-
HashTable *props = _intern_extractor(zobj)->php_properties; \
131-
if (!props) { \
132-
ALLOC_HASHTABLE(props); \
133-
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
134-
_intern_extractor(zobj)->php_properties = props; \
135-
} \
136-
zval *value = zend_hash_find(props, name); \
137-
if (value) { \
138-
if (has_set_exists == ZEND_PROPERTY_NOT_EMPTY) { \
139-
return zend_is_true(value); \
140-
} \
141-
if (has_set_exists < ZEND_PROPERTY_NOT_EMPTY) { \
142-
ZEND_ASSERT(has_set_exists == ZEND_PROPERTY_ISSET); \
143-
ZVAL_DEREF(value); \
144-
return (Z_TYPE_P(value) != IS_NULL); \
145-
} \
146-
ZEND_ASSERT(has_set_exists == ZEND_PROPERTY_EXISTS); \
147-
return true; \
148-
} \
149-
return false; \
150-
} \
151-
static void php_phongo_##_name##_unset_property(zend_object *zobj, zend_string *name, void **cache_slot) \
152-
{ \
153-
HashTable *props = _intern_extractor(zobj)->php_properties; \
154-
if (!props) { \
155-
ALLOC_HASHTABLE(props); \
156-
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
157-
_intern_extractor(zobj)->php_properties = props; \
158-
} \
159-
zend_hash_del(props, name); \
160-
} \
161-
\
162-
static zval *php_phongo_##_name##_get_property_ptr_ptr(zend_object *zobj, zend_string *name, int type, void **cache_slot) \
163-
{ \
164-
HashTable *props = _intern_extractor(zobj)->php_properties; \
165-
if (!props) { \
166-
ALLOC_HASHTABLE(props); \
167-
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
168-
_intern_extractor(zobj)->php_properties = props; \
169-
} \
170-
\
171-
zval *value = zend_hash_find(props, name); \
172-
if (value) { \
173-
return value; \
174-
} \
175-
return zend_hash_add(props, name, &EG(uninitialized_zval)); \
105+
#define PHONGO_GET_PROPERTY_HANDLERS_NO_GC(_name, _intern_extractor) \
106+
static zval* php_phongo_##_name##_read_property(zend_object* zobj, zend_string* member, int type, void** cache_slot, zval* rv) \
107+
{ \
108+
HashTable* props = _intern_extractor(zobj)->php_properties; \
109+
if (!props) { \
110+
ALLOC_HASHTABLE(props); \
111+
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
112+
_intern_extractor(zobj)->php_properties = props; \
113+
} \
114+
return zend_hash_find(props, member); \
115+
} \
116+
\
117+
static zval* php_phongo_##_name##_write_property(zend_object* zobj, zend_string* name, zval* value, void** cache_slot) \
118+
{ \
119+
Z_TRY_ADDREF_P(value); \
120+
HashTable* props = _intern_extractor(zobj)->php_properties; \
121+
if (!props) { \
122+
ALLOC_HASHTABLE(props); \
123+
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
124+
_intern_extractor(zobj)->php_properties = props; \
125+
} \
126+
return zend_hash_add_new(props, name, value); \
127+
} \
128+
static int php_phongo_##_name##_has_property(zend_object* zobj, zend_string* name, int has_set_exists, void** cache_slot) \
129+
{ \
130+
HashTable* props = _intern_extractor(zobj)->php_properties; \
131+
if (!props) { \
132+
ALLOC_HASHTABLE(props); \
133+
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
134+
_intern_extractor(zobj)->php_properties = props; \
135+
} \
136+
zval* value = zend_hash_find(props, name); \
137+
if (value) { \
138+
if (has_set_exists == ZEND_PROPERTY_NOT_EMPTY) { \
139+
return zend_is_true(value); \
140+
} \
141+
if (has_set_exists < ZEND_PROPERTY_NOT_EMPTY) { \
142+
ZEND_ASSERT(has_set_exists == ZEND_PROPERTY_ISSET); \
143+
ZVAL_DEREF(value); \
144+
return (Z_TYPE_P(value) != IS_NULL); \
145+
} \
146+
ZEND_ASSERT(has_set_exists == ZEND_PROPERTY_EXISTS); \
147+
return true; \
148+
} \
149+
return false; \
150+
} \
151+
static void php_phongo_##_name##_unset_property(zend_object* zobj, zend_string* name, void** cache_slot) \
152+
{ \
153+
HashTable* props = _intern_extractor(zobj)->php_properties; \
154+
if (!props) { \
155+
ALLOC_HASHTABLE(props); \
156+
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
157+
_intern_extractor(zobj)->php_properties = props; \
158+
} \
159+
zend_hash_del(props, name); \
160+
} \
161+
\
162+
static zval* php_phongo_##_name##_get_property_ptr_ptr(zend_object* zobj, zend_string* name, int type, void** cache_slot) \
163+
{ \
164+
HashTable* props = _intern_extractor(zobj)->php_properties; \
165+
if (!props) { \
166+
ALLOC_HASHTABLE(props); \
167+
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
168+
_intern_extractor(zobj)->php_properties = props; \
169+
} \
170+
\
171+
zval* value = zend_hash_find(props, name); \
172+
if (value) { \
173+
return value; \
174+
} \
175+
return zend_hash_add(props, name, &EG(uninitialized_zval)); \
176176
}
177177

178178
#define PHONGO_ZVAL_EXCEPTION_NAME(e) (ZSTR_VAL(e->ce->name))

src/BSON/Binary.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,13 @@ static void php_phongo_binary_free_object(zend_object* object)
213213
efree(intern->data);
214214
}
215215

216-
217216
if (intern->properties) {
218-
HashTable* props = intern->properties;
217+
HashTable* props = intern->properties;
219218
intern->properties = NULL;
220219
zend_hash_release(props);
221220
}
222221
if (intern->php_properties) {
223-
HashTable* props = intern->php_properties;
222+
HashTable* props = intern->php_properties;
224223
intern->php_properties = NULL;
225224
zend_hash_release(props);
226225
}
@@ -296,18 +295,18 @@ void php_phongo_binary_init_ce(INIT_FUNC_ARGS)
296295
php_phongo_binary_ce->create_object = php_phongo_binary_create_object;
297296

298297
memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
299-
php_phongo_handler_binary.compare = php_phongo_binary_compare_objects;
300-
php_phongo_handler_binary.clone_obj = php_phongo_binary_clone_object;
301-
php_phongo_handler_binary.get_debug_info = php_phongo_binary_get_debug_info;
302-
php_phongo_handler_binary.get_properties = php_phongo_binary_get_properties;
303-
php_phongo_handler_binary.read_property = php_phongo_binary_read_property;
304-
php_phongo_handler_binary.write_property = php_phongo_binary_write_property;
305-
php_phongo_handler_binary.has_property = php_phongo_binary_has_property;
306-
php_phongo_handler_binary.unset_property = php_phongo_binary_unset_property;
298+
php_phongo_handler_binary.compare = php_phongo_binary_compare_objects;
299+
php_phongo_handler_binary.clone_obj = php_phongo_binary_clone_object;
300+
php_phongo_handler_binary.get_debug_info = php_phongo_binary_get_debug_info;
301+
php_phongo_handler_binary.get_properties = php_phongo_binary_get_properties;
302+
php_phongo_handler_binary.read_property = php_phongo_binary_read_property;
303+
php_phongo_handler_binary.write_property = php_phongo_binary_write_property;
304+
php_phongo_handler_binary.has_property = php_phongo_binary_has_property;
305+
php_phongo_handler_binary.unset_property = php_phongo_binary_unset_property;
307306
php_phongo_handler_binary.get_property_ptr_ptr = php_phongo_binary_get_property_ptr_ptr;
308-
php_phongo_handler_binary.get_gc = php_phongo_binary_get_gc;
309-
php_phongo_handler_binary.free_obj = php_phongo_binary_free_object;
310-
php_phongo_handler_binary.offset = XtOffsetOf(php_phongo_binary_t, std);
307+
php_phongo_handler_binary.get_gc = php_phongo_binary_get_gc;
308+
php_phongo_handler_binary.free_obj = php_phongo_binary_free_object;
309+
php_phongo_handler_binary.offset = XtOffsetOf(php_phongo_binary_t, std);
311310
}
312311

313312
bool phongo_binary_new(zval* object, const char* data, size_t data_len, bson_subtype_t type)

0 commit comments

Comments
 (0)