Skip to content

Mark multple functions as static #13864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions Zend/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ ZEND_API void zend_ssa_find_false_dependencies(const zend_op_array *op_array, ze
/* }}} */

/* From "Hacker's Delight" */
zend_ulong minOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong minOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;

Expand All @@ -567,7 +567,7 @@ zend_ulong minOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return a | c;
}

zend_ulong maxOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong maxOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;

Expand All @@ -590,7 +590,7 @@ zend_ulong maxOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return b | d;
}

zend_ulong minAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong minAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;

Expand All @@ -613,7 +613,7 @@ zend_ulong minAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return a & c;
}

zend_ulong maxAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong maxAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;

Expand All @@ -637,16 +637,6 @@ zend_ulong maxAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return b & d;
}

zend_ulong minXOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
return minAND(a, b, ~d, ~c) | minAND(~b, ~a, c, d);
}

zend_ulong maxXOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
return maxOR(0, maxAND(a, b, ~d, ~c), 0, maxAND(~b, ~a, c, d));
}

/* Based on "Hacker's Delight" */

/*
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static zend_result zend_ast_add_unpacked_element(zval *result, zval *expr) {
return FAILURE;
}

zend_class_entry *zend_ast_fetch_class(zend_ast *ast, zend_class_entry *scope)
static zend_class_entry *zend_ast_fetch_class(zend_ast *ast, zend_class_entry *scope)
{
return zend_fetch_class_with_scope(zend_ast_get_str(ast), (ast->attr >> ZEND_CONST_EXPR_NEW_FETCH_TYPE_SHIFT) | ZEND_FETCH_CLASS_EXCEPTION, scope);
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ZEND_MINIT_FUNCTION(core) { /* {{{ */
}
/* }}} */

zend_module_entry zend_builtin_module = { /* {{{ */
static zend_module_entry zend_builtin_module = { /* {{{ */
STANDARD_MODULE_HEADER,
"Core",
ext_functions,
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ static zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /*
}
/* }}} */

zend_string *zend_resolve_class_name_ast(zend_ast *ast) /* {{{ */
static zend_string *zend_resolve_class_name_ast(zend_ast *ast) /* {{{ */
{
zval *class_name = zend_ast_get_zval(ast);
if (Z_TYPE_P(class_name) != IS_STRING) {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_generators.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ static const zend_object_iterator_funcs zend_generator_iterator_functions = {
};

/* by_ref is int due to Iterator API */
zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
static zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
{
zend_object_iterator *iterator;
zend_generator *generator = (zend_generator*)Z_OBJ_P(object);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ static void do_inherit_method(zend_string *key, zend_function *parent, zend_clas
}
/* }}} */

inheritance_status property_types_compatible(
static inheritance_status property_types_compatible(
const zend_property_info *parent_info, const zend_property_info *child_info) {
if (ZEND_TYPE_PURE_MASK(parent_info->type) == ZEND_TYPE_PURE_MASK(child_info->type)
&& ZEND_TYPE_NAME(parent_info->type) == ZEND_TYPE_NAME(child_info->type)) {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_ini_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "win32/syslog.h"
#endif

int ini_parse(void);
static int ini_parse(void);

#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg
Expand Down
14 changes: 7 additions & 7 deletions Zend/zend_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
#define ZEND_OBSERVABLE_FN(function) \
(ZEND_MAP_PTR(function->common.run_time_cache) && !(function->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))

zend_llist zend_observers_fcall_list;
zend_llist zend_observer_function_declared_callbacks;
zend_llist zend_observer_class_linked_callbacks;
zend_llist zend_observer_error_callbacks;
zend_llist zend_observer_fiber_init;
zend_llist zend_observer_fiber_switch;
zend_llist zend_observer_fiber_destroy;
static zend_llist zend_observers_fcall_list;
static zend_llist zend_observer_function_declared_callbacks;
static zend_llist zend_observer_class_linked_callbacks;
static zend_llist zend_observer_error_callbacks;
static zend_llist zend_observer_fiber_init;
static zend_llist zend_observer_fiber_switch;
static zend_llist zend_observer_fiber_destroy;

int zend_observer_fcall_op_array_extension;
int zend_observer_fcall_internal_function_extension;
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static sigset_t global_sigmask;

/* {{{ zend_signal_handler_defer
* Blocks signals if in critical section */
void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
static void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
{
int errno_save = errno;
zend_signal_queue_t *queue, *qtmp;
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_weakrefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef struct _zend_weakmap_iterator {
#define ZEND_WEAKREF_ENCODE(p, t) ((void *) (((uintptr_t) (p)) | (t)))

zend_class_entry *zend_ce_weakref;
zend_class_entry *zend_ce_weakmap;
static zend_class_entry *zend_ce_weakmap;
static zend_object_handlers zend_weakref_handlers;
static zend_object_handlers zend_weakmap_handlers;

Expand Down
8 changes: 4 additions & 4 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */

zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period;
zend_class_entry *date_ce_immutable, *date_ce_interface;
zend_class_entry *date_ce_date_error, *date_ce_date_object_error, *date_ce_date_range_error;
zend_class_entry *date_ce_date_exception, *date_ce_date_invalid_timezone_exception, *date_ce_date_invalid_operation_exception, *date_ce_date_malformed_string_exception, *date_ce_date_malformed_interval_string_exception, *date_ce_date_malformed_period_string_exception;
static zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period;
static zend_class_entry *date_ce_immutable, *date_ce_interface;
static zend_class_entry *date_ce_date_error, *date_ce_date_object_error, *date_ce_date_range_error;
static zend_class_entry *date_ce_date_exception, *date_ce_date_invalid_timezone_exception, *date_ce_date_invalid_operation_exception, *date_ce_date_malformed_string_exception, *date_ce_date_malformed_interval_string_exception, *date_ce_date_malformed_period_string_exception;


PHPAPI zend_class_entry *php_date_get_date_ce(void)
Expand Down
2 changes: 1 addition & 1 deletion ext/hash/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# endif
#endif

HashTable php_hash_hashtable;
static HashTable php_hash_hashtable;
zend_class_entry *php_hashcontext_ce;
static zend_object_handlers php_hashcontext_handlers;

Expand Down
2 changes: 1 addition & 1 deletion ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#define PHP_ICONV_IMPL_VALUE "unknown"
#endif

char *get_iconv_version(void) {
static char *get_iconv_version(void) {
char *version = "unknown";

#ifdef HAVE_LIBICONV
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
return new_persistent_script;
}

zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
static zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
{
zend_persistent_script *persistent_script;
zend_op_array *op_array = NULL;
Expand Down
8 changes: 4 additions & 4 deletions ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ typedef struct _php_openssl_x509_request_object {
zend_object std;
} php_openssl_request_object;

zend_class_entry *php_openssl_request_ce;
static zend_class_entry *php_openssl_request_ce;

static inline php_openssl_request_object *php_openssl_request_from_obj(zend_object *obj) {
return (php_openssl_request_object *)((char *)(obj) - XtOffsetOf(php_openssl_request_object, std));
Expand Down Expand Up @@ -225,7 +225,7 @@ typedef struct _php_openssl_pkey_object {
zend_object std;
} php_openssl_pkey_object;

zend_class_entry *php_openssl_pkey_ce;
static zend_class_entry *php_openssl_pkey_ce;

static inline php_openssl_pkey_object *php_openssl_pkey_from_obj(zend_object *obj) {
return (php_openssl_pkey_object *)((char *)(obj) - XtOffsetOf(php_openssl_pkey_object, std));
Expand Down Expand Up @@ -486,7 +486,7 @@ void php_openssl_store_errors(void)
/* }}} */

/* {{{ php_openssl_errors_set_mark */
void php_openssl_errors_set_mark(void) {
static void php_openssl_errors_set_mark(void) {
if (!OPENSSL_G(errors)) {
return;
}
Expand All @@ -500,7 +500,7 @@ void php_openssl_errors_set_mark(void) {
/* }}} */

/* {{{ php_openssl_errors_restore_mark */
void php_openssl_errors_restore_mark(void) {
static void php_openssl_errors_restore_mark(void) {
if (!OPENSSL_G(errors)) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions ext/openssl/xp_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static struct timeval php_openssl_subtract_timeval(struct timeval a, struct time
static int php_openssl_compare_timeval(struct timeval a, struct timeval b);
static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count);

const php_stream_ops php_openssl_socket_ops;
static const php_stream_ops php_openssl_socket_ops;

/* Certificate contexts used for server-side SNI selection */
typedef struct _php_openssl_sni_cert_t {
Expand Down Expand Up @@ -1650,7 +1650,7 @@ static int php_openssl_server_alpn_callback(SSL *ssl_handle,

#endif

zend_result php_openssl_setup_crypto(php_stream *stream,
static zend_result php_openssl_setup_crypto(php_stream *stream,
php_openssl_netstream_data_t *sslsock,
php_stream_xport_crypto_param *cparam) /* {{{ */
{
Expand Down Expand Up @@ -2701,7 +2701,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret)
}
/* }}} */

const php_stream_ops php_openssl_socket_ops = {
static const php_stream_ops php_openssl_socket_ops = {
php_openssl_sockop_write, php_openssl_sockop_read,
php_openssl_sockop_close, php_openssl_sockop_flush,
"tcp_socket/ssl",
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/dirstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, bool is_dir);

const php_stream_ops phar_dir_ops = {
static const php_stream_ops phar_dir_ops = {
phar_dir_write, /* write */
phar_dir_read, /* read */
phar_dir_close, /* close */
Expand Down
4 changes: 2 additions & 2 deletions ext/phar/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "stream.h"
#include "dirstream.h"

const php_stream_ops phar_ops = {
static const php_stream_ops phar_ops = {
phar_stream_write, /* write */
phar_stream_read, /* read */
phar_stream_close, /* close */
Expand All @@ -34,7 +34,7 @@ const php_stream_ops phar_ops = {
NULL, /* set option */
};

const php_stream_wrapper_ops phar_stream_wops = {
static const php_stream_wrapper_ops phar_stream_wops = {
phar_wrapper_open_url,
NULL, /* phar_wrapper_close */
NULL, /* phar_wrapper_stat, */
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -2868,7 +2868,7 @@ PHP_METHOD(EmptyIterator, next)
}
} /* }}} */

zend_result spl_append_it_next_iterator(spl_dual_it_object *intern) /* {{{*/
static zend_result spl_append_it_next_iterator(spl_dual_it_object *intern) /* {{{*/
{
spl_dual_it_free(intern);

Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static inline spl_SplObjectStorage *spl_object_storage_from_obj(zend_object *obj

#define Z_SPLOBJSTORAGE_P(zv) spl_object_storage_from_obj(Z_OBJ_P((zv)))

void spl_SplObjectStorage_free_storage(zend_object *object) /* {{{ */
static void spl_SplObjectStorage_free_storage(zend_object *object) /* {{{ */
{
spl_SplObjectStorage *intern = spl_object_storage_from_obj(object);

Expand Down
6 changes: 3 additions & 3 deletions ext/sqlite3/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ static zend_object_handlers sqlite3_stmt_object_handlers;
static zend_object_handlers sqlite3_result_object_handlers;

/* Class entries */
zend_class_entry *php_sqlite3_exception_ce;
zend_class_entry *php_sqlite3_sc_entry;
zend_class_entry *php_sqlite3_stmt_entry;
static zend_class_entry *php_sqlite3_exception_ce;
static zend_class_entry *php_sqlite3_sc_entry;
static zend_class_entry *php_sqlite3_stmt_entry;
zend_class_entry *php_sqlite3_result_entry;

/* {{{ Error Handler */
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/ftp_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ static const php_stream_ops php_ftp_dirstream_ops = {
};

/* {{{ php_stream_ftp_opendir */
php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
static php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
zend_string **opened_path, php_stream_context *context STREAMS_DC)
{
php_stream *stream, *reuseid, *datastream = NULL;
Expand Down
6 changes: 3 additions & 3 deletions ext/standard/mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ PHP_FUNCTION(mail)
/* }}} */


void php_mail_log_crlf_to_spaces(char *message) {
static void php_mail_log_crlf_to_spaces(char *message) {
/* Find all instances of carriage returns or line feeds and
* replace them with spaces. Thus, a log line is always one line
* long
Expand All @@ -352,15 +352,15 @@ void php_mail_log_crlf_to_spaces(char *message) {
}
}

void php_mail_log_to_syslog(char *message) {
static void php_mail_log_to_syslog(char *message) {
/* Write 'message' to syslog. */
#ifdef HAVE_SYSLOG_H
php_syslog(LOG_NOTICE, "%s", message);
#endif
}


void php_mail_log_to_file(char *filename, char *message, size_t message_size) {
static void php_mail_log_to_file(char *filename, char *message, size_t message_size) {
/* Write 'message' to the given file. */
uint32_t flags = REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR;
php_stream *stream = php_stream_open_wrapper(filename, "a", flags, NULL);
Expand Down
6 changes: 3 additions & 3 deletions ext/standard/php_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int php_stream_output_close(php_stream *stream, int close_handle) /* {{{
}
/* }}} */

const php_stream_ops php_stream_output_ops = {
static const php_stream_ops php_stream_output_ops = {
php_stream_output_write,
php_stream_output_read,
php_stream_output_close,
Expand Down Expand Up @@ -134,7 +134,7 @@ static int php_stream_input_seek(php_stream *stream, zend_off_t offset, int when
}
/* }}} */

const php_stream_ops php_stream_input_ops = {
static const php_stream_ops php_stream_input_ops = {
php_stream_input_write,
php_stream_input_read,
php_stream_input_close,
Expand Down Expand Up @@ -173,7 +173,7 @@ static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, i
}
/* }}} */

php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
zend_string **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
{
int fd = -1;
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/user_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void userfilter_dtor(php_stream_filter *thisfilter)
zval_ptr_dtor(obj);
}

php_stream_filter_status_t userfilter_filter(
static php_stream_filter_status_t userfilter_filter(
php_stream *stream,
php_stream_filter *thisfilter,
php_stream_bucket_brigade *buckets_in,
Expand Down
4 changes: 2 additions & 2 deletions ext/tokenizer/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define zendcursor LANG_SCNG(yy_cursor)
#define zendlimit LANG_SCNG(yy_limit)

zend_class_entry *php_token_ce;
static zend_class_entry *php_token_ce;

/* {{{ tokenizer_module_entry */
zend_module_entry tokenizer_module_entry = {
Expand Down Expand Up @@ -410,7 +410,7 @@ static zval *extract_token_id_to_replace(zval *token_zv, const char *text, size_
return NULL;
}

void on_event(
static void on_event(
zend_php_scanner_event event, int token, int line,
const char *text, size_t length, void *context)
{
Expand Down
Loading
Loading