]> granicus.if.org Git - php/commitdiff
Fix [-Wundef] warnings in LDAP extension
authorGeorge Peter Banyard <girgias@php.net>
Fri, 15 May 2020 22:30:38 +0000 (00:30 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Sun, 17 May 2020 22:37:15 +0000 (00:37 +0200)
ext/ldap/ldap.c
ext/ldap/ldap.stub.php
ext/ldap/ldap_arginfo.h

index 47787e82d47aa2cb220565f21c805b9559ef99e6..4c3e69f762a59a3e0487a0a0654c7b708555a2cf 100644 (file)
@@ -733,7 +733,7 @@ PHP_MINIT_FUNCTION(ldap)
        REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS);
        REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS);
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        /* LDAP options */
        REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
        REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS);
@@ -1088,7 +1088,7 @@ PHP_FUNCTION(ldap_connect)
  */
 static int _get_lderrno(LDAP *ldap)
 {
-#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
+#if LDAP_API_VERSION > 2000 || defined(HAVE_ORALDAP)
        int lderr;
 
        /* New versions of OpenLDAP do it this way */
@@ -1104,7 +1104,7 @@ static int _get_lderrno(LDAP *ldap)
  */
 static void _set_lderrno(LDAP *ldap, int lderr)
 {
-#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
+#if LDAP_API_VERSION > 2000 || defined(HAVE_ORALDAP)
        /* New versions of OpenLDAP do it this way */
        ldap_set_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
 #else
@@ -1397,7 +1397,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
 {
        /* sizelimit */
        if (sizelimit > -1) {
-#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP
+#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP)
                ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit);
                ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit);
 #else
@@ -1408,7 +1408,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
 
        /* timelimit */
        if (timelimit > -1) {
-#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP
+#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP)
                ldap_get_option(ldap, LDAP_OPT_TIMELIMIT, old_timelimit);
                ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
 #else
@@ -1419,7 +1419,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
 
        /* deref */
        if (deref > -1) {
-#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP
+#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP)
                ldap_get_option(ldap, LDAP_OPT_DEREF, old_deref);
                ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
 #else
@@ -1877,12 +1877,12 @@ PHP_FUNCTION(ldap_get_entries)
                        add_index_string(&tmp1, num_attrib, attribute);
 
                        num_attrib++;
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                        ldap_memfree(attribute);
 #endif
                        attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
                }
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                if (ber != NULL) {
                        ber_free(ber, 0);
                }
@@ -1895,7 +1895,7 @@ PHP_FUNCTION(ldap_get_entries)
                } else {
                        add_assoc_null(&tmp1, "dn");
                }
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                ldap_memfree(dn);
 #else
                free(dn);
@@ -1938,7 +1938,7 @@ PHP_FUNCTION(ldap_first_attribute)
                RETURN_FALSE;
        } else {
                RETVAL_STRING(attribute);
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                ldap_memfree(attribute);
 #endif
        }
@@ -1973,7 +1973,7 @@ PHP_FUNCTION(ldap_next_attribute)
        }
 
        if ((attribute = ldap_next_attribute(ld->link, resultentry->data, resultentry->ber)) == NULL) {
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                if (resultentry->ber != NULL) {
                        ber_free(resultentry->ber, 0);
                        resultentry->ber = NULL;
@@ -1982,7 +1982,7 @@ PHP_FUNCTION(ldap_next_attribute)
                RETURN_FALSE;
        } else {
                RETVAL_STRING(attribute);
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                ldap_memfree(attribute);
 #endif
        }
@@ -2033,12 +2033,12 @@ PHP_FUNCTION(ldap_get_attributes)
                add_index_string(return_value, num_attrib, attribute);
 
                num_attrib++;
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                ldap_memfree(attribute);
 #endif
                attribute = ldap_next_attribute(ld->link, resultentry->data, ber);
        }
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
        if (ber != NULL) {
                ber_free(ber, 0);
        }
@@ -2114,7 +2114,7 @@ PHP_FUNCTION(ldap_get_dn)
        text = ldap_get_dn(ld->link, resultentry->data);
        if (text != NULL) {
                RETVAL_STRING(text);
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                ldap_memfree(text);
 #else
                free(text);
@@ -2173,7 +2173,7 @@ PHP_FUNCTION(ldap_dn2ufn)
 
        if (ufn != NULL) {
                RETVAL_STRING(ufn);
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
                ldap_memfree(ufn);
 #endif
        } else {
@@ -2980,7 +2980,7 @@ cleanup:
 }
 /* }}} */
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 /* {{{ proto bool ldap_get_option(resource link, int option, mixed retval)
    Get the current value of various session-wide parameters */
 PHP_FUNCTION(ldap_get_option)
@@ -3601,7 +3601,7 @@ static void php_ldap_do_rename(INTERNAL_FUNCTION_PARAMETERS, int ext)
                newparent = NULL;
        }
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        if (serverctrls) {
                lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls);
                if (lserverctrls == NULL) {
@@ -3701,7 +3701,7 @@ PHP_FUNCTION(ldap_start_tls)
 }
 /* }}} */
 #endif
-#endif /* (LDAP_API_VERSION > 2000) || HAVE_ORALDAP */
+#endif /* (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) */
 
 #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
 /* {{{ _ldap_rebind_proc()
index b2ff7213966edb41c94a6e10a907576f66b8932e..81a78055bf3a2070a952af9782c7be86f43e01c7 100644 (file)
@@ -209,7 +209,7 @@ function ldap_control_paged_result($link, int $pagesize, bool $iscritical = fals
 function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {}
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 /** @param resource $link_identifier */
 function ldap_rename($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []): bool {}
 
index 7f8ee30cde6b7c834f349d6a849b1b5104defa0e..9c63bda1a46f34965c0867a438c2adf57451478c 100644 (file)
@@ -204,7 +204,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result_respon
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_rename, 0, 5, _IS_BOOL, 0)
        ZEND_ARG_INFO(0, link_identifier)
        ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
@@ -215,7 +215,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_rename, 0, 5, _IS_BOOL, 0)
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
        ZEND_ARG_INFO(0, link_identifier)
        ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
@@ -226,7 +226,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_option, 0, 2, _IS_BOOL, 0)
        ZEND_ARG_INFO(0, link_identifier)
        ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
@@ -234,7 +234,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_option, 0, 2, _IS_BOOL,
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_option, 0, 3, _IS_BOOL, 0)
        ZEND_ARG_INFO(0, link_identifier)
        ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
@@ -242,21 +242,21 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_option, 0, 3, _IS_BOOL,
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2)
        ZEND_ARG_INFO(0, link)
        ZEND_ARG_INFO(0, result)
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2)
        ZEND_ARG_INFO(0, link)
        ZEND_ARG_INFO(0, entry)
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE)
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_reference, 0, 3, _IS_BOOL, 0)
        ZEND_ARG_INFO(0, link)
        ZEND_ARG_INFO(0, entry)
@@ -264,7 +264,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_reference, 0, 3, _IS_
 ZEND_END_ARG_INFO()
 #endif
 
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT)
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_result, 0, 3, _IS_BOOL, 0)
        ZEND_ARG_INFO(0, link)
        ZEND_ARG_INFO(0, result)
@@ -398,28 +398,28 @@ ZEND_FUNCTION(ldap_control_paged_result);
 #if defined(LDAP_CONTROL_PAGEDRESULTS)
 ZEND_FUNCTION(ldap_control_paged_result_response);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_FUNCTION(ldap_rename);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_FUNCTION(ldap_rename_ext);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_FUNCTION(ldap_get_option);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_FUNCTION(ldap_set_option);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_FUNCTION(ldap_first_reference);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
 ZEND_FUNCTION(ldap_next_reference);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE)
 ZEND_FUNCTION(ldap_parse_reference);
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT)
 ZEND_FUNCTION(ldap_parse_result);
 #endif
 #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
@@ -504,28 +504,28 @@ static const zend_function_entry ext_functions[] = {
 #if defined(LDAP_CONTROL_PAGEDRESULTS)
        ZEND_DEP_FE(ldap_control_paged_result_response, arginfo_ldap_control_paged_result_response)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        ZEND_FE(ldap_rename, arginfo_ldap_rename)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        ZEND_FE(ldap_rename_ext, arginfo_ldap_rename_ext)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        ZEND_FE(ldap_get_option, arginfo_ldap_get_option)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        ZEND_FE(ldap_set_option, arginfo_ldap_set_option)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        ZEND_FE(ldap_first_reference, arginfo_ldap_first_reference)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
        ZEND_FE(ldap_next_reference, arginfo_ldap_next_reference)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE)
        ZEND_FE(ldap_parse_reference, arginfo_ldap_parse_reference)
 #endif
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
+#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT)
        ZEND_FE(ldap_parse_result, arginfo_ldap_parse_result)
 #endif
 #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)