Commit Graph

279 Commits

Author SHA1 Message Date
George Peter Banyard
fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
George Peter Banyard
1b2ec73c1d Drop various unused macros/APIs
Also convert_libmagic_pattern() to return a zend_string*

Closes GH-6029
2020-08-26 12:59:43 +02:00
Nikita Popov
d3eeeb6882 Don't leak attributes on internal classes
Also add zend_hash_release() API to complement zend_array_release(),
because the latter is specific to non-persistent zval arrays.
2020-06-05 10:29:49 +02:00
Nikita Popov
718e55c3e0 Add zend_array_release() function
To complement zend_string_release() and zend_object_release().
2020-05-06 11:27:20 +02:00
Levi Morrison
90db6f2cc5 Add case insensitive find_ptr hash functions
- zend_hash_find_ptr_lc(ht, zend_string *key)
 - zend_hash_str_find_ptr_lc(ht, const char *str, size_t len)

Note that zend_hash_str_find_ptr_lc used to exist in zend_compile.c
as        zend_hash_find_ptr_lc. When exporting this I figured it
was best to use the same conventions as the rest of zend_hash.h.
2020-04-26 23:29:41 +02:00
Nikita Popov
7352213b38 Early return if variadic type check fails
Don't check all the remaining arguments after one check failed.
I don't think this makes an observable behavior difference,
because we already suppress duplicate exceptions in argument
type error reporting.
2020-04-17 14:24:44 +02:00
Nikita Popov
33ef3d64da Use separate typedef for bucket comparison function
Avoid performing the same casting dance inside each sort compare
function.
2020-03-04 12:46:06 +01:00
Andrey Gromov
84c4a4f17d Make zend_hash_rehash() a void function
It always succeeds.

Closes GH-4304.
2019-06-27 09:48:19 +02:00
Nikita Popov
036b0a1d4d Merge branch 'PHP-7.4' 2019-06-11 12:30:11 +02:00
Nikita Popov
51fb8dc422 Add specialized pair construction API
Closes GH-3990.
2019-06-11 12:29:55 +02:00
Dmitry Stogov
c64fe84f8b Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid double copying
2019-05-28 13:35:29 +03:00
Dmitry Stogov
b2cb6a4a27 Avoid double copying 2019-05-28 13:35:00 +03:00
Nikita Popov
39724f4645 Merge branch 'PHP-7.4' 2019-04-16 12:21:48 +02:00
Nikita Popov
2bdd212887 Merge branch 'PHP-7.3' into PHP-7.4 2019-04-16 12:21:16 +02:00
Nikita Popov
f9a755d0d2 Fix HT flags copying wrt iterator count
HT_FLAGS() includes the full flag word, including the iterator
count. When we're fully reassigning it, we need to make sure that
we either really do want to copy the iterator count (as in some
cases in array.c) or we need to mask only the actual flag byte.

Add an assert to hash_iterators_del() to make sure the iterator
count is non-zero (which is how I ran into this) and make sure that
the iterator count is correctly preserved during array splicing.
2019-04-16 12:14:45 +02:00
rjhdby
e86cdce549 Make zend_hash_sort() return void
This function always succeeds, so remove the success indicator
return value.
2019-03-22 09:51:47 +01:00
Tyson Andre
da3316ff0f Fix typos in code comments in Zend/ [skip ci] 2019-02-18 17:56:28 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Dmitry Stogov
76d8f3923e Revert HASH_FLAG_INITIALIZED into HASH_FLAG_UNINITIALIZED. 2018-12-28 11:22:18 +03:00
Dmitry Stogov
675a8a64c3 Use HT_IS_INITIALIZED() and HT_INVALIDATE() macros instead of hackish HT_FLAGS assumtions. 2018-12-27 22:48:25 +03:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +02:00
Dmitry Stogov
27b0fecd2e Turn zend_hash_exists() into inline function 2018-09-19 13:55:53 +03:00
Dmitry Stogov
cd9f0a22fc Perform run-time binding reusing HashTable bucket (without new bucket insertion). 2018-08-29 00:35:07 +03:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
ebd1f5af3e API cleanup.
Removed useless filename and lineno arguments, used in DEBUG build.
The patch doesn't break source compatibility of public API (only binary compatibility).
2018-07-23 15:24:07 +03:00
Dmitry Stogov
3b6e1ee4ee Improved "Fast Shutdown". 2018-07-17 17:31:04 +03:00
Dmitry Stogov
0b90cf85a6 Removed "dead" code (zend_hash_update() never fails) 2018-06-01 11:58:57 +03:00
Dmitry Stogov
0d72bb8fcb Optimize zend_new_array() for special case, when size <= HT_MIN_SIZE 2018-05-31 01:17:55 +03:00
Dmitry Stogov
4df89a31b0 Eliminate useless checks 2018-04-04 02:12:26 +03:00
Dmitry Stogov
a795bd8265 Optimize zend_hash_real_init() 2018-03-23 00:13:45 +03:00
Dmitry Stogov
d7f2dc4ec6 Improve HashTable iterators handling:
- Avoid iterators check/update on each HashTable update opration
- Keep position equal (or above) nNumUsed instead of HT_INVALID_IDX
- Fixed iterators handling in array_unshift()
2018-03-22 02:41:49 +03:00
Dmitry Stogov
a4109e1f4c Added expectation 2018-03-06 23:22:01 +03:00
Dmitry Stogov
6fb5568b2d Merge HashTable.u.v.consistency into HashTable.u.v.flags 2018-01-22 15:32:34 +03:00
Dmitry Stogov
ebf900a9eb Introduce mcros to access HashTable iterators counter 2018-01-22 14:14:35 +03:00
Dmitry Stogov
9cbb521094 Access HashTable.u.flags through HT_FLAGS() macro. 2018-01-22 13:36:15 +03:00
Dmitry Stogov
742d5a01ed Get rid of IS_TYPE_COPYABLE. 2018-01-19 17:47:26 +03:00
Dmitry Stogov
c533396ce4 Strength reduction 2018-01-10 14:23:43 +03:00
Dmitry Stogov
20a1124f63 Added expectation 2018-01-10 12:37:13 +03:00
Gabriel Caruso
6687e8db15 Trailing whitespaces on Zend
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-04 02:41:57 -02:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
4dfbfe93aa Use cheaper API 2017-12-18 11:55:14 +08:00
Li-Wen Hsu
72ec23d823 Fix bug #75677: Drop fastcall attribute on variadic function
Fastcall generally doesn't make sense on variadic functions. For
clang in particular this eliminates a "fastcall calling convention
ignored on variadic function" warning.
2017-12-15 21:56:08 +01:00
Dmitry Stogov
ec2dde0c0b Introduced zend_hash_find_ex() that may avoid unnecessary hash value check. 2017-11-24 14:01:19 +03:00
Dmitry Stogov
2e83924682 Added zend_hash_add_new_mem/zend_hash_str_add_new_mem. Use them to add new elements into PCRE cache (we checked the existance before). 2017-10-31 10:43:10 +03:00
Dmitry Stogov
9cf87aa196 Avoid HashTable allocations for empty arrays (using zend_empty_array). 2017-10-24 17:27:31 +03:00
Dmitry Stogov
254b74b85f HASH_FLAG_PERSISTENT renamed into IS_ARRAY_PERSISTENT and moved into GC_FLAGS (to be consistent with IS_STR_PERSISTENT). 2017-10-06 02:54:14 +03:00
Dmitry Stogov
cb9d81ef4f Refactored recursion pretection 2017-10-06 01:34:50 +03:00
Dmitry Stogov
44e0b79ac6 Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values. 2017-09-20 02:25:56 +03:00