]> granicus.if.org Git - php/commitdiff
remove PHP_VERSION_ID ifdef's, limiting to 5.4 branch
authorBoris Lytochkin <lytboris@php.net>
Sun, 12 Jun 2011 12:26:51 +0000 (12:26 +0000)
committerBoris Lytochkin <lytboris@php.net>
Sun, 12 Jun 2011 12:26:51 +0000 (12:26 +0000)
ext/snmp/snmp.c

index af4d80b8082a0a90bfea043b23dfb47516e084d0..bc0651a202f48e8237e0bd36b7d26f35cd3551ed 100644 (file)
 #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
 
-#if PHP_VERSION_ID < 50300
-#define Z_ADDREF_P(pz) pz->refcount++
-#define Z_ISREF_PP(oid) (PZVAL_IS_REF(*(oid)))
-#define Z_REFCOUNT_P(pz) pz->refcount
-#define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc
-#define zend_parse_parameters_none() zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")
-#endif
-
 /* For net-snmp prior to 5.4 */
 #ifndef HAVE_SHUTDOWN_SNMP_LOGGING
 extern netsnmp_log_handler *logh_head;
@@ -482,9 +474,6 @@ static void php_snmp_object_free_storage(void *object TSRMLS_DC)
 
 static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
 {
-#if PHP_VERSION_ID < 50399
-       zval *tmp;
-#endif
        zend_object_value retval;
        php_snmp_object *intern;
 
@@ -493,11 +482,7 @@ static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS
        memset(&intern->zo, 0, sizeof(php_snmp_object));
 
        zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
-#if PHP_VERSION_ID < 50399
-       zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *));
-#else
        object_properties_init(&intern->zo, class_type);
-#endif
 
        retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) php_snmp_object_free_storage, NULL TSRMLS_CC);
        retval.handlers = (zend_object_handlers *) &php_snmp_object_handlers;
@@ -1707,31 +1692,17 @@ PHP_METHOD(snmp, __construct)
        long retries = SNMP_DEFAULT_RETRIES;
        long version = SNMP_DEFAULT_VERSION;
        int argc = ZEND_NUM_ARGS();
-#if PHP_VERSION_ID > 50300
        zend_error_handling error_handling;
-#endif
 
        snmp_object = (php_snmp_object *)zend_object_store_get_object(object TSRMLS_CC);
-#if PHP_VERSION_ID > 50300
        zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
-#else
-       php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
-#endif
        
        if (zend_parse_parameters(argc TSRMLS_CC, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) {
-#if PHP_VERSION_ID > 50300
                zend_restore_error_handling(&error_handling TSRMLS_CC);
-#else
-               php_std_error_handling();
-#endif
                return;
        }
 
-#if PHP_VERSION_ID > 50300
        zend_restore_error_handling(&error_handling TSRMLS_CC);
-#else
-       php_std_error_handling();
-#endif
 
        switch(version) {
                case SNMP_VERSION_1:
@@ -1877,11 +1848,7 @@ void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, p
 
 /* {{{ php_snmp_read_property(zval *object, zval *member, int type[, const zend_literal *key])
    Generic object property reader */
-#if PHP_VERSION_ID < 50399
-zval *php_snmp_read_property(zval *object, zval *member, int type TSRMLS_DC)
-#else
 zval *php_snmp_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC)
-#endif
 {
        zval tmp_member;
        zval *retval;
@@ -1911,11 +1878,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, const zend_li
                }
        } else {
                zend_object_handlers * std_hnd = zend_get_std_object_handlers();
-#if PHP_VERSION_ID < 50399
-               retval = std_hnd->read_property(object, member, type TSRMLS_CC);
-#else
                retval = std_hnd->read_property(object, member, type, key TSRMLS_CC);
-#endif
        }
 
        if (member == &tmp_member) {
@@ -1927,11 +1890,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, const zend_li
 
 /* {{{ php_snmp_write_property(zval *object, zval *member, zval *value[, const zend_literal *key])
    Generic object property writer */
-#if PHP_VERSION_ID < 50399
-void php_snmp_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
-#else
 void php_snmp_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
-#endif
 {
        zval tmp_member;
        php_snmp_object *obj;
@@ -1958,11 +1917,7 @@ void php_snmp_write_property(zval *object, zval *member, zval *value, const zend
                }
        } else {
                zend_object_handlers * std_hnd = zend_get_std_object_handlers();
-#if PHP_VERSION_ID < 50399
-               std_hnd->write_property(object, member, value TSRMLS_CC);
-#else
                std_hnd->write_property(object, member, value, key TSRMLS_CC);
-#endif
        }
 
        if (member == &tmp_member) {
@@ -1973,11 +1928,7 @@ void php_snmp_write_property(zval *object, zval *member, zval *value, const zend
 
 /* {{{ php_snmp_has_property(zval *object, zval *member, int has_set_exists[, const zend_literal *key])
    Generic object property checker */
-#if PHP_VERSION_ID < 50399
-static int php_snmp_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC)
-#else
 static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, const zend_literal *key TSRMLS_DC)
-#endif
 {
        php_snmp_prop_handler *hnd;
        int ret = 0;
@@ -1988,11 +1939,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
                                ret = 1;
                                break;
                        case 0: {
-#if PHP_VERSION_ID < 50399
-                               zval *value = php_snmp_read_property(object, member, BP_VAR_IS TSRMLS_CC);
-#else
                                zval *value = php_snmp_read_property(object, member, BP_VAR_IS, key TSRMLS_CC);
-#endif
                                if (value != EG(uninitialized_zval_ptr)) {
                                        ret = Z_TYPE_P(value) != IS_NULL? 1:0;
                                        /* refcount is 0 */
@@ -2002,11 +1949,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
                                break;
                        }
                        default: {
-#if PHP_VERSION_ID < 50399
-                               zval *value = php_snmp_read_property(object, member, BP_VAR_IS TSRMLS_CC);
-#else
                                zval *value = php_snmp_read_property(object, member, BP_VAR_IS, key TSRMLS_CC);
-#endif
                                if (value != EG(uninitialized_zval_ptr)) {
                                        convert_to_boolean(value);
                                        ret = Z_BVAL_P(value)? 1:0;
@@ -2019,11 +1962,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
                }
        } else {
                zend_object_handlers * std_hnd = zend_get_std_object_handlers();
-#if PHP_VERSION_ID < 50399
-               ret = std_hnd->has_property(object, member, has_set_exists TSRMLS_CC);
-#else
                ret = std_hnd->has_property(object, member, has_set_exists, key TSRMLS_CC);
-#endif
        }
        return ret;
 }
@@ -2043,11 +1982,7 @@ static HashTable *php_snmp_get_properties(zval *object TSRMLS_DC)
        ulong num_key;
 
        obj = (php_snmp_object *)zend_objects_get_address(object TSRMLS_CC);
-#if PHP_VERSION_ID < 50399
-       props = obj->zo.properties;
-#else
        props = zend_std_get_properties(object TSRMLS_CC);
-#endif
 
        zend_hash_internal_pointer_reset_ex(&php_snmp_properties, &pos);