Skip to content

Commit 095c90a

Browse files
committed
Fix [-Wundef] warnings in LDAP extension
1 parent 9f2d42a commit 095c90a

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

ext/ldap/ldap.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ PHP_MINIT_FUNCTION(ldap)
733733
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS);
734734
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS);
735735

736-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
736+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
737737
/* LDAP options */
738738
REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
739739
REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS);
@@ -1088,7 +1088,7 @@ PHP_FUNCTION(ldap_connect)
10881088
*/
10891089
static int _get_lderrno(LDAP *ldap)
10901090
{
1091-
#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
1091+
#if LDAP_API_VERSION > 2000 || defined(HAVE_ORALDAP)
10921092
int lderr;
10931093

10941094
/* New versions of OpenLDAP do it this way */
@@ -1104,7 +1104,7 @@ static int _get_lderrno(LDAP *ldap)
11041104
*/
11051105
static void _set_lderrno(LDAP *ldap, int lderr)
11061106
{
1107-
#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
1107+
#if LDAP_API_VERSION > 2000 || defined(HAVE_ORALDAP)
11081108
/* New versions of OpenLDAP do it this way */
11091109
ldap_set_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
11101110
#else
@@ -1397,7 +1397,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
13971397
{
13981398
/* sizelimit */
13991399
if (sizelimit > -1) {
1400-
#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP
1400+
#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP)
14011401
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit);
14021402
ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit);
14031403
#else
@@ -1408,7 +1408,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
14081408

14091409
/* timelimit */
14101410
if (timelimit > -1) {
1411-
#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP
1411+
#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP)
14121412
ldap_get_option(ldap, LDAP_OPT_TIMELIMIT, old_timelimit);
14131413
ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
14141414
#else
@@ -1419,7 +1419,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
14191419

14201420
/* deref */
14211421
if (deref > -1) {
1422-
#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP
1422+
#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP)
14231423
ldap_get_option(ldap, LDAP_OPT_DEREF, old_deref);
14241424
ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
14251425
#else
@@ -1877,12 +1877,12 @@ PHP_FUNCTION(ldap_get_entries)
18771877
add_index_string(&tmp1, num_attrib, attribute);
18781878

18791879
num_attrib++;
1880-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
1880+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
18811881
ldap_memfree(attribute);
18821882
#endif
18831883
attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
18841884
}
1885-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
1885+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
18861886
if (ber != NULL) {
18871887
ber_free(ber, 0);
18881888
}
@@ -1895,7 +1895,7 @@ PHP_FUNCTION(ldap_get_entries)
18951895
} else {
18961896
add_assoc_null(&tmp1, "dn");
18971897
}
1898-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
1898+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
18991899
ldap_memfree(dn);
19001900
#else
19011901
free(dn);
@@ -1938,7 +1938,7 @@ PHP_FUNCTION(ldap_first_attribute)
19381938
RETURN_FALSE;
19391939
} else {
19401940
RETVAL_STRING(attribute);
1941-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
1941+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
19421942
ldap_memfree(attribute);
19431943
#endif
19441944
}
@@ -1973,7 +1973,7 @@ PHP_FUNCTION(ldap_next_attribute)
19731973
}
19741974

19751975
if ((attribute = ldap_next_attribute(ld->link, resultentry->data, resultentry->ber)) == NULL) {
1976-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
1976+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
19771977
if (resultentry->ber != NULL) {
19781978
ber_free(resultentry->ber, 0);
19791979
resultentry->ber = NULL;
@@ -1982,7 +1982,7 @@ PHP_FUNCTION(ldap_next_attribute)
19821982
RETURN_FALSE;
19831983
} else {
19841984
RETVAL_STRING(attribute);
1985-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
1985+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
19861986
ldap_memfree(attribute);
19871987
#endif
19881988
}
@@ -2033,12 +2033,12 @@ PHP_FUNCTION(ldap_get_attributes)
20332033
add_index_string(return_value, num_attrib, attribute);
20342034

20352035
num_attrib++;
2036-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
2036+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
20372037
ldap_memfree(attribute);
20382038
#endif
20392039
attribute = ldap_next_attribute(ld->link, resultentry->data, ber);
20402040
}
2041-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
2041+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
20422042
if (ber != NULL) {
20432043
ber_free(ber, 0);
20442044
}
@@ -2114,7 +2114,7 @@ PHP_FUNCTION(ldap_get_dn)
21142114
text = ldap_get_dn(ld->link, resultentry->data);
21152115
if (text != NULL) {
21162116
RETVAL_STRING(text);
2117-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
2117+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
21182118
ldap_memfree(text);
21192119
#else
21202120
free(text);
@@ -2173,7 +2173,7 @@ PHP_FUNCTION(ldap_dn2ufn)
21732173

21742174
if (ufn != NULL) {
21752175
RETVAL_STRING(ufn);
2176-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS
2176+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS
21772177
ldap_memfree(ufn);
21782178
#endif
21792179
} else {
@@ -2980,7 +2980,7 @@ PHP_FUNCTION(ldap_compare)
29802980
}
29812981
/* }}} */
29822982

2983-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
2983+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
29842984
/* {{{ proto bool ldap_get_option(resource link, int option, mixed retval)
29852985
Get the current value of various session-wide parameters */
29862986
PHP_FUNCTION(ldap_get_option)
@@ -3601,7 +3601,7 @@ static void php_ldap_do_rename(INTERNAL_FUNCTION_PARAMETERS, int ext)
36013601
newparent = NULL;
36023602
}
36033603

3604-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
3604+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
36053605
if (serverctrls) {
36063606
lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls);
36073607
if (lserverctrls == NULL) {
@@ -3701,7 +3701,7 @@ PHP_FUNCTION(ldap_start_tls)
37013701
}
37023702
/* }}} */
37033703
#endif
3704-
#endif /* (LDAP_API_VERSION > 2000) || HAVE_ORALDAP */
3704+
#endif /* (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) */
37053705

37063706
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
37073707
/* {{{ _ldap_rebind_proc()

ext/ldap/ldap.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function ldap_control_paged_result($link, int $pagesize, bool $iscritical = fals
209209
function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {}
210210
#endif
211211

212-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
212+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
213213
/** @param resource $link_identifier */
214214
function ldap_rename($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []): bool {}
215215

ext/ldap/ldap_arginfo.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result_respon
204204
ZEND_END_ARG_INFO()
205205
#endif
206206

207-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
207+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
208208
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_rename, 0, 5, _IS_BOOL, 0)
209209
ZEND_ARG_INFO(0, link_identifier)
210210
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)
215215
ZEND_END_ARG_INFO()
216216
#endif
217217

218-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
218+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
219219
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
220220
ZEND_ARG_INFO(0, link_identifier)
221221
ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
@@ -226,45 +226,45 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
226226
ZEND_END_ARG_INFO()
227227
#endif
228228

229-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
229+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
230230
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_option, 0, 2, _IS_BOOL, 0)
231231
ZEND_ARG_INFO(0, link_identifier)
232232
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
233233
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, retval, "null")
234234
ZEND_END_ARG_INFO()
235235
#endif
236236

237-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
237+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
238238
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_option, 0, 3, _IS_BOOL, 0)
239239
ZEND_ARG_INFO(0, link_identifier)
240240
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
241241
ZEND_ARG_INFO(0, newval)
242242
ZEND_END_ARG_INFO()
243243
#endif
244244

245-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
245+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
246246
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2)
247247
ZEND_ARG_INFO(0, link)
248248
ZEND_ARG_INFO(0, result)
249249
ZEND_END_ARG_INFO()
250250
#endif
251251

252-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
252+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
253253
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2)
254254
ZEND_ARG_INFO(0, link)
255255
ZEND_ARG_INFO(0, entry)
256256
ZEND_END_ARG_INFO()
257257
#endif
258258

259-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
259+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE)
260260
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_reference, 0, 3, _IS_BOOL, 0)
261261
ZEND_ARG_INFO(0, link)
262262
ZEND_ARG_INFO(0, entry)
263263
ZEND_ARG_INFO(1, referrals)
264264
ZEND_END_ARG_INFO()
265265
#endif
266266

267-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
267+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT)
268268
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_result, 0, 3, _IS_BOOL, 0)
269269
ZEND_ARG_INFO(0, link)
270270
ZEND_ARG_INFO(0, result)
@@ -398,28 +398,28 @@ ZEND_FUNCTION(ldap_control_paged_result);
398398
#if defined(LDAP_CONTROL_PAGEDRESULTS)
399399
ZEND_FUNCTION(ldap_control_paged_result_response);
400400
#endif
401-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
401+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
402402
ZEND_FUNCTION(ldap_rename);
403403
#endif
404-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
404+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
405405
ZEND_FUNCTION(ldap_rename_ext);
406406
#endif
407-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
407+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
408408
ZEND_FUNCTION(ldap_get_option);
409409
#endif
410-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
410+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
411411
ZEND_FUNCTION(ldap_set_option);
412412
#endif
413-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
413+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
414414
ZEND_FUNCTION(ldap_first_reference);
415415
#endif
416-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
416+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
417417
ZEND_FUNCTION(ldap_next_reference);
418418
#endif
419-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
419+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE)
420420
ZEND_FUNCTION(ldap_parse_reference);
421421
#endif
422-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
422+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT)
423423
ZEND_FUNCTION(ldap_parse_result);
424424
#endif
425425
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
@@ -504,28 +504,28 @@ static const zend_function_entry ext_functions[] = {
504504
#if defined(LDAP_CONTROL_PAGEDRESULTS)
505505
ZEND_DEP_FE(ldap_control_paged_result_response, arginfo_ldap_control_paged_result_response)
506506
#endif
507-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
507+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
508508
ZEND_FE(ldap_rename, arginfo_ldap_rename)
509509
#endif
510-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
510+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
511511
ZEND_FE(ldap_rename_ext, arginfo_ldap_rename_ext)
512512
#endif
513-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
513+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
514514
ZEND_FE(ldap_get_option, arginfo_ldap_get_option)
515515
#endif
516-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
516+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
517517
ZEND_FE(ldap_set_option, arginfo_ldap_set_option)
518518
#endif
519-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
519+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
520520
ZEND_FE(ldap_first_reference, arginfo_ldap_first_reference)
521521
#endif
522-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
522+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP)
523523
ZEND_FE(ldap_next_reference, arginfo_ldap_next_reference)
524524
#endif
525-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
525+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE)
526526
ZEND_FE(ldap_parse_reference, arginfo_ldap_parse_reference)
527527
#endif
528-
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
528+
#if (LDAP_API_VERSION > 2000) || defined(HAVE_NSLDAP) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT)
529529
ZEND_FE(ldap_parse_result, arginfo_ldap_parse_result)
530530
#endif
531531
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)

0 commit comments

Comments
 (0)