com php-src: Remove superfluous allocation checks around ZMM-based functions: ext/mbstring/mbstring.c ext/mysqlnd/mysqlnd_net. c ext/mysqlnd/mysqlnd_vio.c ext/opcache/Optimizer/zend _cfg.c ext/opcache/Optimizer/zend_ssa.c ext/opcache /Optimizer/zend_worklist.h ext/standard/filters.c mai n/streams/filter.c sapi/litespeed/lsapi_main.c
[email protected] (Nikita Popov)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 9f08aff3fdd4d1898f5b4bd72ac4c9614d4c65a3 Author: Thomas Punt <[email protected]> Sat, 1 Apr 2017 19:38:37 +0100 Committer: Nikita Popov <[email protected]> Sun, 2 Apr 2017 00:58:19 +0200 Parents: e0f68ae1441bac063e2a72b980f1ddfee596ea25 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9f08aff3fdd4d1898f5b4bd72ac4c9614d4c65a3 Log: Remove superfluous allocation checks around ZMM-based functions Changed paths: M ext/mbstring/mbstring.c M ext/mysqlnd/mysqlnd_net.c M ext/mysqlnd/mysqlnd_vio.c M ext/opcache/Optimizer/zend_cfg.c M ext/opcache/Optimizer/zend_ssa.c M ext/opcache/Optimizer/zend_worklist.h M ext/standard/filters.c M main/streams/filter.c M sapi/litespeed/lsapi_main.c Diff: diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 05ebadb..3edaf87 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -732,9 +732,6 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en } else tmpstr = (char *)estrndup(value, value_length); - if (tmpstr == NULL) { - return FAILURE; - } /* count the number of listed encoding names */ endp = tmpstr + value_length; n = 1; diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index c6a7f72..80b6b46 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -906,9 +906,6 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net) zend_bool any_flag = FALSE; DBG_ENTER("mysqlnd_net::enable_ssl"); - if (!context) { - DBG_RETURN(FAIL); - } if (net->data->options.ssl_key) { zval key_zval; diff --git a/ext/mysqlnd/mysqlnd_vio.c b/ext/mysqlnd/mysqlnd_vio.c index 33de52c..ef097c9 100644 --- a/ext/mysqlnd/mysqlnd_vio.c +++ b/ext/mysqlnd/mysqlnd_vio.c @@ -492,9 +492,6 @@ MYSQLND_METHOD(mysqlnd_vio, enable_ssl)(MYSQLND_VIO * const net) zend_bool any_flag = FALSE; DBG_ENTER("mysqlnd_vio::enable_ssl"); - if (!context) { - DBG_RETURN(FAIL); - } if (net->data->options.ssl_key) { zval key_zval; diff --git a/ext/opcache/Optimizer/zend_cfg.c b/ext/opcache/Optimizer/zend_cfg.c index 2163d7c..06cf266 100644 --- a/ext/opcache/Optimizer/zend_cfg.c +++ b/ext/opcache/Optimizer/zend_cfg.c @@ -291,9 +291,6 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b cfg->split_at_recv = (build_flags & ZEND_CFG_RECV_ENTRY) != 0 && (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0; cfg->map = block_map = zend_arena_calloc(arena, op_array->last, sizeof(uint32_t)); - if (!block_map) { - return FAILURE; - } /* Build CFG, Step 1: Find basic blocks starts, calculate number of blocks */ BB_START(0); @@ -460,9 +457,6 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b /* Build CFG, Step 2: Build Array of Basic Blocks */ cfg->blocks = blocks = zend_arena_calloc(arena, sizeof(zend_basic_block), blocks_count); - if (!blocks) { - return FAILURE; - } blocks_count = -1; @@ -594,10 +588,6 @@ int zend_cfg_build_predecessors(zend_arena **arena, zend_cfg *cfg) /* {{{ */ cfg->predecessors = predecessors = (int*)zend_arena_calloc(arena, sizeof(int), edges); - if (!predecessors) { - return FAILURE; - } - edges = 0; for (b = blocks; b < end; b++) { if (b->flags & ZEND_BB_REACHABLE) { diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index 2f5f359..4c3361b 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -869,9 +869,6 @@ int zend_build_ssa(zend_arena **arena, const zend_script *script, const zend_op_ ssa->rt_constants = (build_flags & ZEND_RT_CONSTANTS); ssa_blocks = zend_arena_calloc(arena, blocks_count, sizeof(zend_ssa_block)); - if (!ssa_blocks) { - return FAILURE; - } ssa->blocks = ssa_blocks; /* Compute Variable Liveness */ diff --git a/ext/opcache/Optimizer/zend_worklist.h b/ext/opcache/Optimizer/zend_worklist.h index 73c0bca..98b20a9 100644 --- a/ext/opcache/Optimizer/zend_worklist.h +++ b/ext/opcache/Optimizer/zend_worklist.h @@ -44,9 +44,6 @@ static inline int zend_worklist_stack_prepare(zend_arena **arena, zend_worklist_ ZEND_ASSERT(len >= 0); stack->buf = (int*)zend_arena_calloc(arena, sizeof(*stack->buf), len); - if (!stack->buf) { - return FAILURE; - } stack->len = 0; stack->capacity = len; @@ -91,9 +88,6 @@ static inline int zend_worklist_prepare(zend_arena **arena, zend_worklist *workl { ZEND_ASSERT(len >= 0); worklist->visited = (zend_bitset)zend_arena_calloc(arena, sizeof(zend_ulong), zend_bitset_len(len)); - if (!worklist->visited) { - return FAILURE; - } return zend_worklist_stack_prepare(arena, &worklist->stack, len); } diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 37205d5..ff955ae 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -1807,10 +1807,6 @@ static php_stream_filter *consumed_filter_create(const char *filtername, zval *f /* Create this filter */ data = pecalloc(1, sizeof(php_consumed_filter_data), persistent); - if (!data) { - php_error_docref(NULL, E_WARNING, "Failed allocating %zd bytes", sizeof(php_consumed_filter_data)); - return NULL; - } data->persistent = persistent; data->consumed = 0; data->offset = ~0; @@ -2015,10 +2011,6 @@ static php_stream_filter *chunked_filter_create(const char *filtername, zval *fi /* Create this filter */ data = (php_chunked_filter_data *)pecalloc(1, sizeof(php_chunked_filter_data), persistent); - if (!data) { - php_error_docref(NULL, E_WARNING, "Failed allocating %zd bytes", sizeof(php_chunked_filter_data)); - return NULL; - } data->state = CHUNK_SIZE_START; data->chunk_size = 0; data->persistent = persistent; diff --git a/main/streams/filter.c b/main/streams/filter.c index 901cf00..bb167c4 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -130,10 +130,6 @@ PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **le *left = (php_stream_bucket*)pecalloc(1, sizeof(php_stream_bucket), in->is_persistent); *right = (php_stream_bucket*)pecalloc(1, sizeof(php_stream_bucket), in->is_persistent); - if (*left == NULL || *right == NULL) { - goto exit_fail; - } - (*left)->buf = pemalloc(length, in->is_persistent); (*left)->buflen = length; memcpy((*left)->buf, in->buf, length); @@ -149,21 +145,6 @@ PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **le (*right)->is_persistent = in->is_persistent; return SUCCESS; - -exit_fail: - if (*right) { - if ((*right)->buf) { - pefree((*right)->buf, in->is_persistent); - } - pefree(*right, in->is_persistent); - } - if (*left) { - if ((*left)->buf) { - pefree((*left)->buf, in->is_persistent); - } - pefree(*left, in->is_persistent); - } - return FAILURE; } PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index cf9e423..7b17035 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -731,8 +731,6 @@ static int lsapi_activate_user_ini_mk_path(_lsapi_activate_user_ini_ctx *ctx, /* Extract dir name from path_translated * and store it in 'path' */ ctx->path_len = strlen(ctx->path); path = ctx->path = estrndup(SG(request_info).path_translated, ctx->path_len); - if (!path) - return FAILURE; ctx->path_len = zend_dirname(path, ctx->path_len); DEBUG_MESSAGE("dirname: %s", ctx->path);