Skip to content

Commit d1ac7e3

Browse files
committed
Remove some unnecessary HAVE_EXTNAME guards
A recurring pattern in old extension: Putting the whole source code behind HAVE_EXTNAME. This is pointless, as the code is only compiled if the extension is enabled. This removes a couple of them, but not all.
1 parent 8e05c44 commit d1ac7e3

File tree

9 files changed

+2
-48
lines changed

9 files changed

+2
-48
lines changed

ext/curl/curl_file.c

-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "Zend/zend_interfaces.h"
2424
#include "php_curl.h"
2525
#include "curl_file_arginfo.h"
26-
#ifdef HAVE_CURL
2726

2827
PHP_CURL_API zend_class_entry *curl_CURLFile_class;
2928

@@ -132,5 +131,3 @@ void curlfile_register_class(void)
132131
zend_declare_property_string(curl_CURLFile_class, "mime", sizeof("mime")-1, "", ZEND_ACC_PUBLIC);
133132
zend_declare_property_string(curl_CURLFile_class, "postname", sizeof("postname")-1, "", ZEND_ACC_PUBLIC);
134133
}
135-
136-
#endif

ext/curl/interface.c

-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include "Zend/zend_interfaces.h"
2525
#include "Zend/zend_exceptions.h"
2626

27-
#ifdef HAVE_CURL
28-
2927
#include <stdio.h>
3028
#include <string.h>
3129

@@ -3537,5 +3535,3 @@ PHP_FUNCTION(curl_pause)
35373535
RETURN_LONG(curl_easy_pause(ch->cp, bitmask));
35383536
}
35393537
/* }}} */
3540-
3541-
#endif /* HAVE_CURL */

ext/curl/multi.c

-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include "php.h"
2424
#include "Zend/zend_interfaces.h"
2525

26-
#ifdef HAVE_CURL
27-
2826
#include "php_curl.h"
2927

3028
#include <curl/curl.h>
@@ -599,5 +597,3 @@ void curl_multi_register_class(const zend_function_entry *method_entries) {
599597
curl_multi_handlers.clone_obj = NULL;
600598
curl_multi_handlers.cast_object = curl_cast_object;
601599
}
602-
603-
#endif

ext/curl/php_curl.h

+1-12
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
#include "php.h"
2222
#include "zend_smart_str.h"
2323

24-
#ifdef COMPILE_DL_CURL
25-
#undef HAVE_CURL
26-
#define HAVE_CURL 1
27-
#endif
28-
29-
#ifdef HAVE_CURL
30-
3124
#define PHP_CURL_DEBUG 0
3225

3326
#ifdef PHP_WIN32
@@ -45,7 +38,7 @@
4538
#include <curl/multi.h>
4639

4740
extern zend_module_entry curl_module_entry;
48-
#define curl_module_ptr &curl_module_entry
41+
#define phpext_curl_ptr &curl_module_entry
4942

5043
#define CURLOPT_RETURNTRANSFER 19913
5144
#define CURLOPT_BINARYTRANSFER 19914 /* For Backward compatibility */
@@ -180,8 +173,4 @@ int curl_cast_object(zend_object *obj, zval *result, int type);
180173

181174
PHP_CURL_API extern zend_class_entry *curl_CURLFile_class;
182175

183-
#else
184-
#define curl_module_ptr NULL
185-
#endif /* HAVE_CURL */
186-
#define phpext_curl_ptr curl_module_ptr
187176
#endif /* _PHP_CURL_H */

ext/curl/share.c

-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include "php.h"
2424
#include "Zend/zend_interfaces.h"
2525

26-
#ifdef HAVE_CURL
27-
2826
#include "php_curl.h"
2927

3028
#include <curl/curl.h>
@@ -179,5 +177,3 @@ void curl_share_register_class(const zend_function_entry *method_entries) {
179177
curl_share_handlers.get_constructor = curl_share_get_constructor;
180178
curl_share_handlers.clone_obj = NULL;
181179
}
182-
183-
#endif

ext/exif/exif.c

-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include "php.h"
2323
#include "ext/standard/file.h"
2424

25-
#ifdef HAVE_EXIF
26-
2725
/* When EXIF_DEBUG is defined the module generates a lot of debug messages
2826
* that help understanding what is going on. This can and should be used
2927
* while extending the module as it shows if you are at the right position.
@@ -4791,5 +4789,3 @@ PHP_FUNCTION(exif_imagetype)
47914789
}
47924790
}
47934791
/* }}} */
4794-
4795-
#endif

ext/exif/php_exif.h

-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@
1515
+----------------------------------------------------------------------+
1616
*/
1717

18-
#ifdef HAVE_EXIF
19-
2018
#include "php_version.h"
2119
#define PHP_EXIF_VERSION PHP_VERSION
2220

2321
extern zend_module_entry exif_module_entry;
2422
#define phpext_exif_ptr &exif_module_entry
25-
26-
#endif

ext/ftp/ftp.c

-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
#include "php.h"
2323

24-
#ifdef HAVE_FTP
25-
2624
#include <stdio.h>
2725
#include <ctype.h>
2826
#include <stdlib.h>
@@ -2266,5 +2264,3 @@ ftp_nb_continue_write(ftpbuf_t *ftp)
22662264
return PHP_FTP_FAILED;
22672265
}
22682266
/* }}} */
2269-
2270-
#endif /* HAVE_FTP */

ext/ftp/php_ftp.h

+1-9
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
#ifndef _INCLUDED_FTP_H
1919
#define _INCLUDED_FTP_H
2020

21-
#ifdef HAVE_FTP
22-
2321
extern zend_module_entry php_ftp_module_entry;
24-
#define php_ftp_module_ptr &php_ftp_module_entry
22+
#define phpext_ftp_ptr &php_ftp_module_entry
2523

2624
#include "php_version.h"
2725
#define PHP_FTP_VERSION PHP_VERSION
@@ -34,10 +32,4 @@ extern zend_module_entry php_ftp_module_entry;
3432
PHP_MINIT_FUNCTION(ftp);
3533
PHP_MINFO_FUNCTION(ftp);
3634

37-
#define phpext_ftp_ptr php_ftp_module_ptr
38-
39-
#else
40-
#define php_ftp_module_ptr NULL
41-
#endif /* HAVE_FTP */
42-
4335
#endif

0 commit comments

Comments
 (0)