Skip to content

Commit

Permalink
Fixed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgutierrez committed Apr 16, 2015
1 parent 6151e5f commit dc7440a
Show file tree
Hide file tree
Showing 42 changed files with 633 additions and 680 deletions.
6 changes: 6 additions & 0 deletions ext/config.w32
Expand Up @@ -4,6 +4,12 @@ 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 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");
/* 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") {
ADD_EXTENSION_DEP("phalcon", "json");
AC_DEFINE("ZEPHIR_USE_PHP_JSON", 1, "Whether PHP json extension is present at compile time");
}
ADD_SOURCES(configure_module_dirname + "/phalcon/annotations", "scanner.c parser.c", "phalcon");
ADD_SOURCES(configure_module_dirname + "/phalcon/mvc/model", "orm.c", "phalcon");
ADD_SOURCES(configure_module_dirname + "/phalcon/mvc/model/query", "scanner.c parser.c", "phalcon");
Expand Down
4 changes: 2 additions & 2 deletions ext/kernel/concat.c
Expand Up @@ -3,9 +3,9 @@
#include "config.h"
#endif

#include "php.h"
#include <php.h>
#include "php_ext.h"
#include "ext/standard/php_string.h"
#include <ext/standard/php_string.h>
#include "ext.h"

#include "kernel/main.h"
Expand Down
2 changes: 2 additions & 0 deletions ext/kernel/concat.h
Expand Up @@ -5,6 +5,8 @@
#include <php.h>
#include <Zend/zend.h>

#include "kernel/main.h"

#define ZEPHIR_CONCAT_SV(result, op1, op2) \
zephir_concat_sv(&result, op1, sizeof(op1)-1, op2, 0 TSRMLS_CC);
#define ZEPHIR_SCONCAT_SV(result, op1, op2) \
Expand Down
3 changes: 2 additions & 1 deletion ext/kernel/exception.h
Expand Up @@ -21,7 +21,8 @@
#ifndef ZEPHIR_KERNEL_EXCEPTIONS_H
#define ZEPHIR_KERNEL_EXCEPTIONS_H

#include "Zend/zend.h"
#include <Zend/zend.h>
#include "kernel/main.h"

/** Exceptions */
#define ZEPHIR_THROW_EXCEPTION_STR(class_entry, message) \
Expand Down
40 changes: 40 additions & 0 deletions ext/kernel/hash.c
Expand Up @@ -24,9 +24,12 @@

#include "php.h"
#include "php_ext.h"
#include <Zend/zend_hash.h>

#include "kernel/memory.h"

#if PHP_VERSION_ID < 70000

int zephir_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent)
{
#if PHP_VERSION_ID < 50400
Expand All @@ -46,6 +49,7 @@ int zephir_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_
#if ZEND_DEBUG
ht->inconsistent = 0;
#endif

#if PHP_VERSION_ID < 50400
ht->nTableMask = ht->nTableSize - 1;
#else
Expand Down Expand Up @@ -81,6 +85,42 @@ int zephir_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_
return SUCCESS;
}

#else

void zephir_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent)
{
#if ZEND_DEBUG
ht->inconsistent = 0;
#endif

if (nSize >= 0x80000000) {
ht->nTableSize = 0x80000000;
} else {
if (nSize > 3) {
ht->nTableSize = nSize + (nSize >> 2);
} else {
ht->nTableSize = 3;
}
}

ht->nTableMask = 0; /* 0 means that ht->arBuckets is uninitialized */
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nNextFreeElement = 0;
ht->arData = NULL;
ht->arHash = (zend_uint*)&uninitialized_bucket;
ht->pDestructor = pDestructor;
ht->nInternalPointer = INVALID_IDX;
if (persistent) {
ht->u.flags = HASH_FLAG_PERSISTENT | HASH_FLAG_APPLY_PROTECTION;
} else {
ht->u.flags = HASH_FLAG_APPLY_PROTECTION;
}
}

#endif


int zephir_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength)
{
ulong h;
Expand Down
46 changes: 46 additions & 0 deletions ext/kernel/hash.h
Expand Up @@ -23,8 +23,14 @@

#include <php.h>
#include <Zend/zend.h>
#include <Zend/zend_hash.h>

#if PHP_VERSION_ID < 70000
int zephir_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent);
#else
void zephir_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent);
#endif

int zephir_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength);
int zephir_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h);
int zephir_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData);
Expand All @@ -38,6 +44,8 @@ int zephir_hash_unset(HashTable *ht, zval *offset);

#define zephir_hash_move_forward_ex(ht, pos) *pos = (*pos ? (*pos)->pListNext : NULL)

#if PHP_VERSION_ID < 70000

static zend_always_inline int zephir_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos)
{
Bucket *p;
Expand All @@ -50,15 +58,53 @@ static zend_always_inline int zephir_hash_get_current_data_ex(HashTable *ht, voi
}
}

#else

static zend_always_inline zval *zephir_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
{
uint idx = *pos;
Bucket *p;

IS_CONSISTENT(ht);
if (idx != INVALID_IDX) {
p = ht->arData + idx;
return &p->val;
} else {
return NULL;
}
}

#endif

static zend_always_inline int zephir_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
{
#if PHP_VERSION_ID < 70000
HashPosition *current = pos ? pos : &ht->pInternalPointer;
if (*current) {
*current = (*current)->pListLast;
return SUCCESS;
} else {
return FAILURE;
}
#else
uint idx = *pos;

IS_CONSISTENT(ht);

if (idx != INVALID_IDX) {
while (idx > 0) {
idx--;
if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
*pos = idx;
return SUCCESS;
}
}
*pos = INVALID_IDX;
return SUCCESS;
} else {
return FAILURE;
}
#endif
}

#endif
12 changes: 8 additions & 4 deletions ext/kernel/main.h
Expand Up @@ -20,9 +20,9 @@
#ifndef ZEPHIR_KERNEL_MAIN_H
#define ZEPHIR_KERNEL_MAIN_H

#include "Zend/zend_interfaces.h"
#include "ext/spl/spl_exceptions.h"
#include "ext/spl/spl_iterators.h"
#include <Zend/zend_interfaces.h>
#include <ext/spl/spl_exceptions.h>
#include <ext/spl/spl_iterators.h>

/** Main macros */
#define PH_DEBUG 0
Expand All @@ -38,12 +38,16 @@
#define PH_COPY 1024
#define PH_CTOR 4096

#ifndef zend_uint
#define zend_uint uint
#endif

#define SL(str) ZEND_STRL(str)
#define SS(str) ZEND_STRS(str)
#define ISL(str) (zephir_interned_##str), (sizeof(#str)-1)
#define ISS(str) (zephir_interned_##str), (sizeof(#str))

#include "Zend/zend_constants.h"
#include <Zend/zend_constants.h>
#include "kernel/exception.h"

/* Compatibility with PHP 5.3 */
Expand Down
2 changes: 2 additions & 0 deletions ext/kernel/object.h
Expand Up @@ -23,7 +23,9 @@

#include <php.h>
#include <Zend/zend.h>

#include "kernel/globals.h"
#include "kernel/main.h"

/** Class Retrieving/Checking */
int zephir_class_exists(const zval *class_name, int autoload TSRMLS_DC);
Expand Down
4 changes: 2 additions & 2 deletions ext/phalcon.c
Expand Up @@ -53,6 +53,7 @@ zend_class_entry *phalcon_mvc_model_metadata_strategyinterface_ce;
zend_class_entry *phalcon_mvc_model_resultinterface_ce;
zend_class_entry *phalcon_mvc_routerinterface_ce;
zend_class_entry *phalcon_mvc_view_engineinterface_ce;
zend_class_entry *phalcon_acl_roleinterface_ce;
zend_class_entry *phalcon_annotations_readerinterface_ce;
zend_class_entry *phalcon_cryptinterface_ce;
zend_class_entry *phalcon_db_columninterface_ce;
Expand Down Expand Up @@ -88,7 +89,6 @@ zend_class_entry *phalcon_session_baginterface_ce;
zend_class_entry *phalcon_validation_messageinterface_ce;
zend_class_entry *phalcon_acl_adapterinterface_ce;
zend_class_entry *phalcon_acl_resourceinterface_ce;
zend_class_entry *phalcon_acl_roleinterface_ce;
zend_class_entry *phalcon_filter_userfilterinterface_ce;
zend_class_entry *phalcon_mvc_collection_managerinterface_ce;
zend_class_entry *phalcon_mvc_controllerinterface_ce;
Expand Down Expand Up @@ -411,6 +411,7 @@ static PHP_MINIT_FUNCTION(phalcon)
ZEPHIR_INIT(Phalcon_Mvc_Model_ResultInterface);
ZEPHIR_INIT(Phalcon_Mvc_RouterInterface);
ZEPHIR_INIT(Phalcon_Mvc_View_EngineInterface);
ZEPHIR_INIT(Phalcon_Acl_RoleInterface);
ZEPHIR_INIT(Phalcon_Annotations_ReaderInterface);
ZEPHIR_INIT(Phalcon_CryptInterface);
ZEPHIR_INIT(Phalcon_Db_ColumnInterface);
Expand Down Expand Up @@ -446,7 +447,6 @@ static PHP_MINIT_FUNCTION(phalcon)
ZEPHIR_INIT(Phalcon_Validation_MessageInterface);
ZEPHIR_INIT(Phalcon_Acl_AdapterInterface);
ZEPHIR_INIT(Phalcon_Acl_ResourceInterface);
ZEPHIR_INIT(Phalcon_Acl_RoleInterface);
ZEPHIR_INIT(Phalcon_Filter_UserFilterInterface);
ZEPHIR_INIT(Phalcon_Mvc_Collection_ManagerInterface);
ZEPHIR_INIT(Phalcon_Mvc_ControllerInterface);
Expand Down
8 changes: 0 additions & 8 deletions ext/phalcon/acl/adapter.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dc7440a

Please sign in to comment.