Skip to content

Commit

Permalink
Used latest Zephir
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Apr 5, 2017
1 parent f03e046 commit 4d3c73f
Show file tree
Hide file tree
Showing 229 changed files with 2,556 additions and 3,225 deletions.
2 changes: 1 addition & 1 deletion ext/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if test "$PHP_PHALCON" = "yes"; then
fi

AC_DEFINE(HAVE_PHALCON, 1, [Whether you have Phalcon])
phalcon_sources="phalcon.c kernel/main.c kernel/memory.c kernel/exception.c kernel/hash.c kernel/debug.c kernel/backtrace.c kernel/object.c kernel/array.c kernel/extended/array.c kernel/string.c kernel/fcall.c kernel/extended/fcall.c kernel/require.c kernel/file.c kernel/operators.c kernel/math.c kernel/concat.c kernel/variables.c kernel/filter.c kernel/iterator.c kernel/time.c kernel/exit.c phalcon/di/injectionawareinterface.zep.c
phalcon_sources="phalcon.c kernel/main.c kernel/memory.c kernel/exception.c kernel/debug.c kernel/backtrace.c kernel/object.c kernel/array.c kernel/string.c kernel/fcall.c kernel/extended/fcall.c kernel/require.c kernel/file.c kernel/operators.c kernel/math.c kernel/concat.c kernel/variables.c kernel/filter.c kernel/iterator.c kernel/time.c kernel/exit.c phalcon/di/injectionawareinterface.zep.c
phalcon/exception.zep.c
phalcon/events/eventsawareinterface.zep.c
phalcon/validation/validatorinterface.zep.c
Expand Down
4 changes: 2 additions & 2 deletions ext/config.w32
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG_ENABLE("phalcon", "enable phalcon", "no");
if (PHP_PHALCON != "no") {
EXTENSION("phalcon", "phalcon.c", null, "-I"+configure_module_dirname);
ADD_SOURCES(configure_module_dirname + "/kernel", "main.c memory.c exception.c hash.c debug.c backtrace.c object.c array.c string.c fcall.c require.c file.c operators.c math.c concat.c variables.c filter.c iterator.c exit.c time.c", "phalcon");
ADD_SOURCES(configure_module_dirname + "/kernel/extended", "array.c fcall.c", "phalcon");
ADD_SOURCES(configure_module_dirname + "/kernel", "main.c memory.c exception.c debug.c backtrace.c object.c array.c string.c fcall.c require.c file.c operators.c math.c concat.c variables.c filter.c iterator.c exit.c time.c", "phalcon");
ADD_SOURCES(configure_module_dirname + "/kernel/extended", "fcall.c", "phalcon");
/* PCRE is always included on WIN32 */
AC_DEFINE("ZEPHIR_USE_PHP_PCRE", 1, "Whether PHP pcre extension is present at compile time");
if (PHP_JSON != "no") {
Expand Down
54 changes: 36 additions & 18 deletions ext/kernel/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down Expand Up @@ -32,9 +32,27 @@
#include "kernel/debug.h"
#include "kernel/array.h"
#include "kernel/operators.h"
#include "kernel/hash.h"
#include "kernel/backtrace.h"

static zval zephir_get_current_key_w(const HashTable *hash_table, HashPosition *hash_position)
{
Bucket *p;
zval result;

INIT_ZVAL(result);
p = hash_position ? (*hash_position) : hash_table->pInternalPointer;

if (p) {
if (p->nKeyLength) {
ZVAL_STRINGL(&result, (char *) p->arKey, p->nKeyLength - 1, 0);
} else {
ZVAL_LONG(&result, p->h);
}
}

return result;
}

/**
* @brief Fetches @a index if it exists from the array @a arr
* @param[out] fetched <code>&$arr[$index]</code>; @a fetched is modified only when the function returns 1
Expand Down Expand Up @@ -64,7 +82,7 @@ int zephir_array_isset_fetch(zval **fetched, const zval *arr, zval *index, int r
h = Z_ARRVAL_P(arr);
switch (Z_TYPE_P(index)) {
case IS_NULL:
result = zephir_hash_find(h, SS(""), (void**)&val);
result = zend_hash_find(h, SS(""), (void**)&val);
break;

case IS_DOUBLE:
Expand Down Expand Up @@ -109,8 +127,8 @@ int zephir_array_isset_quick_string_fetch(zval **fetched, zval *arr, char *index

zval **zv;

if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (zephir_hash_quick_find(Z_ARRVAL_P(arr), index, index_length, key, (void**) &zv) == SUCCESS) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
if (zend_hash_quick_find(Z_ARRVAL_P(arr), index, index_length, key, (void**) &zv) == SUCCESS) {
*fetched = *zv;
if (!readonly) {
Z_ADDREF_P(*fetched);
Expand All @@ -135,7 +153,7 @@ int zephir_array_isset_long_fetch(zval **fetched, zval *arr, unsigned long index

zval **zv;

if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
if (zend_hash_index_find(Z_ARRVAL_P(arr), index, (void**)&zv) == SUCCESS) {
*fetched = *zv;
if (!readonly) {
Expand Down Expand Up @@ -173,7 +191,7 @@ int ZEPHIR_FASTCALL zephir_array_isset(const zval *arr, zval *index) {
h = Z_ARRVAL_P(arr);
switch (Z_TYPE_P(index)) {
case IS_NULL:
return zephir_hash_exists(h, SS(""));
return zend_hash_exists(h, SS(""));

case IS_DOUBLE:
return zend_hash_index_exists(h, (ulong)Z_DVAL_P(index));
Expand Down Expand Up @@ -220,7 +238,7 @@ int ZEPHIR_FASTCALL zephir_array_isset_string(const zval *arr, const char *index
*/
int ZEPHIR_FASTCALL zephir_array_isset_quick_string(const zval *arr, const char *index, uint index_length, unsigned long key) {

if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
return zend_hash_quick_exists(Z_ARRVAL_P(arr), index, index_length, key);
}

Expand All @@ -237,7 +255,7 @@ int ZEPHIR_FASTCALL zephir_array_isset_quick_string(const zval *arr, const char
*/
int ZEPHIR_FASTCALL zephir_array_isset_long(const zval *arr, unsigned long index) {

if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
return zend_hash_index_exists(Z_ARRVAL_P(arr), index);
}

Expand Down Expand Up @@ -807,7 +825,7 @@ int zephir_array_fetch(zval **return_value, zval *arr, zval *index, int flags ZE
ht = Z_ARRVAL_P(arr);
switch (Z_TYPE_P(index)) {
case IS_NULL:
result = zephir_hash_find(ht, SS(""), (void**) &zv);
result = zend_hash_find(ht, SS(""), (void**) &zv);
sidx = "";
break;

Expand Down Expand Up @@ -879,8 +897,8 @@ int zephir_array_fetch_quick_string(zval **return_value, zval *arr, const char *

zval **zv;

if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (zephir_hash_quick_find(Z_ARRVAL_P(arr), index, index_length, key, (void**) &zv) == SUCCESS) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
if (zend_hash_quick_find(Z_ARRVAL_P(arr), index, index_length, key, (void**) &zv) == SUCCESS) {
*return_value = *zv;
if ((flags & PH_READONLY) != PH_READONLY) {
Z_ADDREF_PP(return_value);
Expand Down Expand Up @@ -942,7 +960,7 @@ int zephir_array_fetch_long(zval **return_value, zval *arr, unsigned long index,

zval **zv;

if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
if (zend_hash_index_find(Z_ARRVAL_P(arr), index, (void**)&zv) == SUCCESS) {
*return_value = *zv;
if ((flags & PH_READONLY) != PH_READONLY) {
Expand Down Expand Up @@ -1135,7 +1153,7 @@ void zephir_array_merge_recursive_n(zval **a1, zval *a2 TSRMLS_DC)
*/
void zephir_array_unshift(zval *arr, zval *arg TSRMLS_DC)
{
if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {

zval** args[1] = { &arg };

Expand Down Expand Up @@ -1167,7 +1185,7 @@ void zephir_array_keys(zval *return_value, zval *input TSRMLS_DC)
ulong num_key;
HashPosition pos;

if (likely(Z_TYPE_P(input) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(input) == IS_ARRAY)) {

array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input)));

Expand Down Expand Up @@ -1197,7 +1215,7 @@ void zephir_array_keys(zval *return_value, zval *input TSRMLS_DC)

void zephir_array_values(zval *return_value, zval *arr)
{
if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
zval **entry;
HashPosition pos;

Expand Down Expand Up @@ -1238,7 +1256,7 @@ int zephir_array_key_exists(zval *arr, zval *key TSRMLS_DC)

int zephir_array_is_associative(zval *arr) {

if (likely(Z_TYPE_P(arr) == IS_ARRAY)) {
if (EXPECTED(Z_TYPE_P(arr) == IS_ARRAY)) {
HashPosition pos;
zval **entry;
char *skey;
Expand Down Expand Up @@ -1481,7 +1499,7 @@ void ZEPHIR_FASTCALL zephir_create_array(zval *return_value, uint size, int init
if (size > 0) {

hashTable = (HashTable *) emalloc(sizeof(HashTable));
zephir_hash_init(hashTable, size, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_init(hashTable, size, NULL, ZVAL_PTR_DTOR, 0);

if (initialize) {

Expand Down
2 changes: 1 addition & 1 deletion ext/kernel/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down
47 changes: 0 additions & 47 deletions ext/kernel/assert.c

This file was deleted.

31 changes: 0 additions & 31 deletions ext/kernel/assert.h

This file was deleted.

2 changes: 1 addition & 1 deletion ext/kernel/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down
4 changes: 2 additions & 2 deletions ext/kernel/backtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand All @@ -23,7 +23,7 @@

#ifndef ZEPHIR_RELEASE

extern void zephir_print_backtrace(void);
void zephir_print_backtrace(void);

#else

Expand Down
2 changes: 1 addition & 1 deletion ext/kernel/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down
4 changes: 2 additions & 2 deletions ext/kernel/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down Expand Up @@ -65,4 +65,4 @@ int zephir_error_space();
int zephir_debug_space();

#endif
#endif
#endif
2 changes: 1 addition & 1 deletion ext/kernel/exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down
2 changes: 1 addition & 1 deletion ext/kernel/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down
6 changes: 3 additions & 3 deletions ext/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand All @@ -26,8 +26,8 @@
#include "kernel/main.h"
#include "kernel/exit.h"

void zephir_exit_empty() {
TSRMLS_FETCH();
void zephir_exit_empty()
{
zend_bailout();
}

Expand Down
2 changes: 1 addition & 1 deletion ext/kernel/exit.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
| Copyright (c) 2011-2017 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
Expand Down
18 changes: 0 additions & 18 deletions ext/kernel/extended/array.c

This file was deleted.

Loading

0 comments on commit 4d3c73f

Please sign in to comment.