Commits

Ruslan Osmanov committed 4879438

Fix coding style
Update copyright strings

  • Participants
  • Parent commits f5e2234

Comments (0)

Files changed (28)

 
 Tested under GNU/Linux only. But likely will work on others too. The following
 also concerns GNU/Linux. If you find it useful to publish instructions for
-other platforms, please drop me a note. 
+other platforms, please drop me a note.
 
 
 PRELIMINARIES
 AUTOMATIC INSTALLATION
 ----------------------
 
-Just run the following as `root`: 
+Just run the following as `root`:
 
 	# pecl install package.xml
 
 
 	$ phpize
 	$ ./configure --with-event-core --with-event-extra --enable-event-debug
-	$ make 
+	$ make
 
 Optionally run tests:
 
 COPYRIGHT
 =========
 
-	Copyright (c) 2013 Ruslan Osmanov <osmanov@php.net>
+	Copyright (c) 2013,2014 Ruslan Osmanov <osmanov@php.net>
 
 	This project is subject to version 3.01 of the PHP license, that is bundled
 	with this package in the file LICENSE, and is available through the

File classes/base.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/buffer.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/buffer_event.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/dns.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/event.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/event_config.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/event_util.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/http.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/http.h

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/http_connection.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/http_request.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/listener.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/ssl_context.c

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File classes/ssl_context.h

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
 dnl +----------------------------------------------------------------------+
 dnl | PHP Version 5                                                        |
 dnl +----------------------------------------------------------------------+
-dnl | Copyrght (C) 1997-2013 The PHP Group                                 |
+dnl | Copyrght (C) 1997-2014 The PHP Group                                 |
 dnl +----------------------------------------------------------------------+
 dnl | This source file is subject to version 3.01 of the PHP license,      |
 dnl | that is bundled with this package in the file LICENSE, and is        |
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
 	PHP_EVENT_VERSION,
 #endif
 #if 0
-    PHP_MODULE_GLOBALS(event),
-    PHP_GINIT(event),
-    NULL,
-    NULL,
-    STANDARD_MODULE_PROPERTIES_EX
+	PHP_MODULE_GLOBALS(event),
+	PHP_GINIT(event),
+	NULL,
+	NULL,
+	STANDARD_MODULE_PROPERTIES_EX,
 #endif
-    STANDARD_MODULE_PROPERTIES
+	STANDARD_MODULE_PROPERTIES
 };
 /* }}} */
 
 
 	if (dnsb->dns_base) {
 		/* Setting fail_requests to 1 makes all in-flight requests get
-	 	 * their callbacks invoked with a canceled error code before it
-	 	 * frees the base*/
+		 * their callbacks invoked with a canceled error code before it
+		 * frees the base*/
 		evdns_base_free(dnsb->dns_base, 1);
 	}
 
 	obj = (php_event_abstract_object_t *) zend_objects_get_address(object TSRMLS_CC);
 
 	if (member->type != IS_STRING) {
-	    tmp_member = *member;
-	    zval_copy_ctor(&tmp_member);
-	    convert_to_string(&tmp_member);
-	    member = &tmp_member;
+		tmp_member = *member;
+		zval_copy_ctor(&tmp_member);
+		convert_to_string(&tmp_member);
+		member = &tmp_member;
 	}
 
 	if (obj->prop_handler != NULL) {
-	    ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
+		ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
 	}
 
 	if (ret == SUCCESS) {
-	    ret = hnd->read_func(obj, &retval TSRMLS_CC);
-	    if (ret == SUCCESS) {
-	        /* ensure we're creating a temporary variable */
-	        Z_SET_REFCOUNT_P(retval, 0);
-	    } else {
-	        retval = EG(uninitialized_zval_ptr);
-	    }
+		ret = hnd->read_func(obj, &retval TSRMLS_CC);
+		if (ret == SUCCESS) {
+			/* ensure we're creating a temporary variable */
+			Z_SET_REFCOUNT_P(retval, 0);
+		} else {
+			retval = EG(uninitialized_zval_ptr);
+		}
 	} else {
-	    zend_object_handlers * std_hnd = zend_get_std_object_handlers();
-	    retval = std_hnd->read_property(object, member, type, key TSRMLS_CC);
+		zend_object_handlers * std_hnd = zend_get_std_object_handlers();
+		retval = std_hnd->read_property(object, member, type, key TSRMLS_CC);
 	}
 
 	if (member == &tmp_member) {
-	    zval_dtor(member);
+		zval_dtor(member);
 	}
 
 	return(retval);
 	int                          ret;
 
 	if (member->type != IS_STRING) {
-	    tmp_member = *member;
-	    zval_copy_ctor(&tmp_member);
-	    convert_to_string(&tmp_member);
-	    member = &tmp_member;
+		tmp_member = *member;
+		zval_copy_ctor(&tmp_member);
+		convert_to_string(&tmp_member);
+		member = &tmp_member;
 	}
 
 	ret = FAILURE;
 	obj = (php_event_abstract_object_t *) zend_objects_get_address(object TSRMLS_CC);
 
 	if (obj->prop_handler != NULL) {
-	    ret = zend_hash_find((HashTable *) obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
+		ret = zend_hash_find((HashTable *) obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
 	}
 	if (ret == SUCCESS) {
-	    hnd->write_func(obj, value TSRMLS_CC);
+		hnd->write_func(obj, value TSRMLS_CC);
 	} else {
-	    zend_object_handlers * std_hnd = zend_get_std_object_handlers();
-	    std_hnd->write_property(object, member, value, key TSRMLS_CC);
+		zend_object_handlers * std_hnd = zend_get_std_object_handlers();
+		std_hnd->write_property(object, member, value, key TSRMLS_CC);
 	}
 
 	if (member == &tmp_member) {
-	    zval_dtor(member);
+		zval_dtor(member);
 	}
 }
 /* }}} */
 	if (obj->prop_handler) {
 		if (zend_hash_find(obj->prop_handler, Z_STRVAL_P(member),
 					Z_STRLEN_P(member) + 1, (void **) &p) == SUCCESS) {
-	    	switch (has_set_exists) {
-	        	case 2:
-	            	ret = 1;
-	            	break;
-	        	case 1: {
-	                		zval *value = read_property(object, member, BP_VAR_IS, key TSRMLS_CC);
-	                		if (value != EG(uninitialized_zval_ptr)) {
-	                	    	convert_to_boolean(value);
-	                	    	ret = Z_BVAL_P(value)? 1:0;
-	                	    	/* refcount is 0 */
-	                	    	Z_ADDREF_P(value);
-	                	    	zval_ptr_dtor(&value);
-	                		}
-	                		break;
-	                	}
-	        	case 0:{
-	                   	   zval *value = read_property(object, member, BP_VAR_IS, key TSRMLS_CC);
-	                   	   if (value != EG(uninitialized_zval_ptr)) {
-	                	   	   ret = Z_TYPE_P(value) != IS_NULL? 1:0;
-	                	   	   /* refcount is 0 */
-	                	   	   Z_ADDREF_P(value);
-	                	   	   zval_ptr_dtor(&value);
-	                   	   }
-	                   	   break;
-	               	   }
-	        	default:
-	               	   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for has_set_exists");
-	    	}
+			switch (has_set_exists) {
+				case 2:
+					ret = 1;
+					break;
+				case 1: {
+							zval *value = read_property(object, member, BP_VAR_IS, key TSRMLS_CC);
+							if (value != EG(uninitialized_zval_ptr)) {
+								convert_to_boolean(value);
+								ret = Z_BVAL_P(value)? 1:0;
+								/* refcount is 0 */
+								Z_ADDREF_P(value);
+								zval_ptr_dtor(&value);
+							}
+							break;
+						}
+				case 0:{
+						   zval *value = read_property(object, member, BP_VAR_IS, key TSRMLS_CC);
+						   if (value != EG(uninitialized_zval_ptr)) {
+							   ret = Z_TYPE_P(value) != IS_NULL? 1:0;
+							   /* refcount is 0 */
+							   Z_ADDREF_P(value);
+							   zval_ptr_dtor(&value);
+						   }
+						   break;
+					   }
+				default:
+					   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for has_set_exists");
+			}
 		} else {
-	    	zend_object_handlers *std_hnd = zend_get_std_object_handlers();
-	    	ret = std_hnd->has_property(object, member, has_set_exists, key TSRMLS_CC);
+			zend_object_handlers *std_hnd = zend_get_std_object_handlers();
+			ret = std_hnd->has_property(object, member, has_set_exists, key TSRMLS_CC);
 		}
 	}
 	return ret;
 
 	zend_hash_internal_pointer_reset_ex(props, &pos);
 	while (zend_hash_get_current_data_ex(props, (void **) &entry, &pos) == SUCCESS) {
-	    zval member;
-	    zval *value;
+		zval member;
+		zval *value;
 
-	    INIT_ZVAL(member);
-	    ZVAL_STRINGL(&member, entry->name, entry->name_len, 0);
+		INIT_ZVAL(member);
+		ZVAL_STRINGL(&member, entry->name, entry->name_len, 0);
 
-	    value = read_property(object, &member, BP_VAR_IS, 0 TSRMLS_CC);
-	    if (value != EG(uninitialized_zval_ptr)) {
-	        Z_ADDREF_P(value);
-	        zend_hash_add(retval, entry->name, entry->name_len + 1, &value, sizeof(zval *) , NULL);
-	    }       
+		value = read_property(object, &member, BP_VAR_IS, 0 TSRMLS_CC);
+		if (value != EG(uninitialized_zval_ptr)) {
+			Z_ADDREF_P(value);
+			zend_hash_add(retval, entry->name, entry->name_len + 1, &value, sizeof(zval *) , NULL);
+		}
 
-	    zend_hash_move_forward_ex(props, &pos);
-	}               
+		zend_hash_move_forward_ex(props, &pos);
+	}
 
-	*is_temp = 1;   
+	*is_temp = 1;
 
 	return retval;
-}               
+}
 /* }}} */
-#endif    
+#endif
 
 /* {{{ get_property_ptr_ptr */
 #if PHP_VERSION_ID >= 50500
 
 #define PHP_EVENT_ADD_CLASS_PROPERTIES(a, b)                                           \
 {                                                                                      \
-    int i = 0;                                                                         \
-    while (b[i].name != NULL) {                                                        \
-        add_property((a), (b)[i].name, (b)[i].name_length,                             \
-                (php_event_prop_read_t)(b)[i].read_func,                               \
-                (php_event_prop_write_t)(b)[i].write_func,                             \
-                (php_event_prop_get_prop_ptr_ptr_t)(b)[i].get_ptr_ptr_func TSRMLS_CC); \
-        i++;                                                                           \
-    }                                                                                  \
+	int i = 0;                                                                         \
+	while (b[i].name != NULL) {                                                        \
+		add_property((a), (b)[i].name, (b)[i].name_length,                             \
+				(php_event_prop_read_t)(b)[i].read_func,                               \
+				(php_event_prop_write_t)(b)[i].write_func,                             \
+				(php_event_prop_get_prop_ptr_ptr_t)(b)[i].get_ptr_ptr_func TSRMLS_CC); \
+		i++;                                                                           \
+	}                                                                                  \
 }
 
 #define PHP_EVENT_DECL_CLASS_PROPERTIES(a, b)                            \
 {                                                                        \
-    int i = 0;                                                           \
-    while (b[i].name != NULL) {                                          \
-        zend_declare_property_null((a), (b)[i].name, (b)[i].name_length, \
-                ZEND_ACC_PUBLIC TSRMLS_CC);                              \
-        i++;                                                             \
-    }                                                                    \
+	int i = 0;                                                           \
+	while (b[i].name != NULL) {                                          \
+		zend_declare_property_null((a), (b)[i].name, (b)[i].name_length, \
+				ZEND_ACC_PUBLIC TSRMLS_CC);                              \
+		i++;                                                             \
+	}                                                                    \
 }
 
 /* {{{ register_classes */
 /* Private functions }}} */
 
 #define REGISTER_EVENT_CLASS_CONST_LONG(pce, const_name, value) \
-    zend_declare_class_constant_long((pce), #const_name,        \
-            sizeof(#const_name) - 1, (long) value TSRMLS_CC)
+	zend_declare_class_constant_long((pce), #const_name,        \
+			sizeof(#const_name) - 1, (long) value TSRMLS_CC)
 
 /* {{{ PHP_MINIT_FUNCTION */
 PHP_MINIT_FUNCTION(event)
 	REGISTER_EVENT_CLASS_CONST_LONG(php_event_ssl_context_ce, OPT_CIPHERS,           PHP_EVENT_OPT_CIPHERS);
 
 	/* Initialize openssl library */
-    SSL_library_init();
-    OpenSSL_add_all_ciphers();
-    OpenSSL_add_all_digests();
-    OpenSSL_add_all_algorithms();
-    SSL_load_error_strings();
+	SSL_library_init();
+	OpenSSL_add_all_ciphers();
+	OpenSSL_add_all_digests();
+	OpenSSL_add_all_algorithms();
+	SSL_load_error_strings();
 
 	/* Create new index which will be used to retreive custom data of the OpenSSL callbacks */
-    php_event_ssl_data_index = SSL_get_ex_new_index(0, "PHP EventSslContext index", NULL, NULL, NULL);
+	php_event_ssl_data_index = SSL_get_ex_new_index(0, "PHP EventSslContext index", NULL, NULL, NULL);
 #endif /* HAVE_EVENT_OPENSSL_LIB */
 
 
 #else
 	php_info_print_table_header(2, "Sockets support", "disabled");
 #endif
-#ifdef PHP_EVENT_DEBUG 
+#ifdef PHP_EVENT_DEBUG
 	php_info_print_table_row(2, "Debug support", "enabled");
 #else
 	php_info_print_table_row(2, "Debug support", "disabled");
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |

File src/common.h

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2011 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2011 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
 
 #endif /* PHP_EVENT_PRIV_H */
 
-/* 
+/*
  * Local variables:
  * tab-width: 4
  * c-basic-offset: 4

File src/structs.h

    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2013 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2011 The PHP Group                                |
+   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
 
 #define PHP_EVENT_REGISTER_CLASS(name, create_func, ce, ce_functions) \
 {                                                                     \
-    zend_class_entry tmp_ce;                                          \
-    INIT_CLASS_ENTRY(tmp_ce, name, ce_functions);                     \
-    ce = zend_register_internal_class(&tmp_ce TSRMLS_CC);             \
-    ce->create_object = create_func;                                  \
+	zend_class_entry tmp_ce;                                          \
+	INIT_CLASS_ENTRY(tmp_ce, name, ce_functions);                     \
+	ce = zend_register_internal_class(&tmp_ce TSRMLS_CC);             \
+	ce->create_object = create_func;                                  \
 }
 
 #define PHP_EVENT_INIT_CLASS_OBJECT(pz, pce) \
-        Z_TYPE_P((pz)) = IS_OBJECT;          \
-        object_init_ex((pz), (pce));         \
-        Z_SET_REFCOUNT_P((pz), 1);           \
-        Z_SET_ISREF_P((pz))
+	do {                                     \
+		Z_TYPE_P((pz)) = IS_OBJECT;          \
+		object_init_ex((pz), (pce));         \
+		Z_SET_REFCOUNT_P((pz), 1);           \
+		Z_SET_ISREF_P((pz));                 \
+	} while (0)
 
 #define PHP_EVENT_FETCH_EVENT(e, ze) \
 	e = (php_event_t *) zend_object_store_get_object(ze TSRMLS_CC)
 #define PHP_EVENT_FETCH_SSL_CONTEXT(p, zp) \
 	p = (php_event_ssl_context_t *) zend_object_store_get_object(zp TSRMLS_CC)
 
-#define PHP_EVENT_TIMEVAL_SET(tv, t)                     \
-        do {                                             \
-            tv.tv_sec  = (long) t;                       \
-            tv.tv_usec = (long) ((t - tv.tv_sec) * 1e6); \
-        } while (0)
+#define PHP_EVENT_TIMEVAL_SET(tv, t)                 \
+	do {                                             \
+		tv.tv_sec  = (long) t;                       \
+		tv.tv_usec = (long) ((t - tv.tv_sec) * 1e6); \
+	} while (0)
 
 #define PHP_EVENT_TIMEVAL_TO_DOUBLE(tv) (tv.tv_sec + tv.tv_usec * 1e-6)
 
 #define PHP_EVENT_SOCKETS_REQUIRED_NORET                                       \
-    php_error_docref(NULL TSRMLS_CC, E_ERROR, "`sockets' extension required. " \
-            "If you have `sockets' installed, rebuild `event' extension")
+	php_error_docref(NULL TSRMLS_CC, E_ERROR, "`sockets' extension required. " \
+			"If you have `sockets' installed, rebuild `event' extension")
+
+#define PHP_EVENT_SOCKETS_REQUIRED_RET    \
+	do {                                  \
+		PHP_EVENT_SOCKETS_REQUIRED_NORET; \
+		RETURN_FALSE;                     \
+	} while (0)
 
-#define PHP_EVENT_SOCKETS_REQUIRED_RET                                         \
-    PHP_EVENT_SOCKETS_REQUIRED_NORET;                                          \
-    RETURN_FALSE
 
 #if defined(PHP_WIN32)
 #if defined(ZTS)
 
 #endif /* PHP_EVENT_UTIL_H */
 
-/* 
+/*
  * Local variables:
  * tab-width: 4
  * c-basic-offset: 4

File tests/05-buffer-pos.phpt

 --TEST--
-Check for manupulation with buffer position
+Check for manipulation with buffer position
 --FILE--
 <?php
 /* Count total occurances of 'str' in 'buf' */