Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions Zend/zend_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "zend_string.h"
#include "zend_sort.h"

BEGIN_EXTERN_C()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the enum exists in 8.5 this probably should be backported too


typedef enum {
HASH_KEY_IS_STRING = 1,
HASH_KEY_IS_LONG,
Expand Down Expand Up @@ -1707,4 +1709,5 @@ static zend_always_inline void _zend_hash_append_ind(HashTable *ht, zend_string
ht->nNumOfElements++;
}

END_EXTERN_C()
#endif /* ZEND_HASH_H */
4 changes: 2 additions & 2 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5309,7 +5309,7 @@ static function (FuncInfo $funcInfo) use ($allConstInfos, $phpVersionIdMinimumCo

foreach ($funcInfo->attributes as $key => $attribute) {
$code .= $attribute->generateCode(
"zend_add_function_attribute(zend_hash_str_find_ptr($functionTable, \"" . $funcInfo->name->getNameForAttributes() . "\", sizeof(\"" . $funcInfo->name->getNameForAttributes() . "\") - 1)",
"zend_add_function_attribute((zend_function *)zend_hash_str_find_ptr($functionTable, \"" . $funcInfo->name->getNameForAttributes() . "\", sizeof(\"" . $funcInfo->name->getNameForAttributes() . "\") - 1)",
"func_" . $funcInfo->name->getNameForAttributes() . "_$key",
$allConstInfos,
$phpVersionIdMinimumCompatibility,
Expand All @@ -5320,7 +5320,7 @@ static function (FuncInfo $funcInfo) use ($allConstInfos, $phpVersionIdMinimumCo
foreach ($funcInfo->args as $index => $arg) {
foreach ($arg->attributes as $key => $attribute) {
$code .= $attribute->generateCode(
"zend_add_parameter_attribute(zend_hash_str_find_ptr($functionTable, \"" . $funcInfo->name->getNameForAttributes() . "\", sizeof(\"" . $funcInfo->name->getNameForAttributes() . "\") - 1), $index",
"zend_add_parameter_attribute((zend_function *)zend_hash_str_find_ptr($functionTable, \"" . $funcInfo->name->getNameForAttributes() . "\", sizeof(\"" . $funcInfo->name->getNameForAttributes() . "\") - 1), $index",
"func_{$funcInfo->name->getNameForAttributes()}_arg{$index}_$key",
$allConstInfos,
$phpVersionIdMinimumCompatibility,
Expand Down
3 changes: 3 additions & 0 deletions ext/date/php_date.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ ZEND_END_MODULE_GLOBALS(date)

#define DATEG(v) ZEND_MODULE_GLOBALS_ACCESSOR(date, v)

BEGIN_EXTERN_C()

PHPAPI time_t php_time(void);

/* Backwards compatibility wrapper */
Expand Down Expand Up @@ -162,5 +164,6 @@ PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object);
PHPAPI bool php_date_initialize(php_date_obj *dateobj, const char *time_str, size_t time_str_len, const char *format, zval *timezone_object, int flags);
PHPAPI void php_date_initialize_from_ts_long(php_date_obj *dateobj, zend_long sec, int usec);
PHPAPI bool php_date_initialize_from_ts_double(php_date_obj *dateobj, double ts);
END_EXTERN_C()

#endif /* PHP_DATE_H */
8 changes: 3 additions & 5 deletions ext/intl/breakiterator/breakiterator_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@

#include <typeinfo>

extern "C" {
#define USE_BREAKITERATOR_POINTER 1
#include "breakiterator_class.h"
#include "breakiterator_arginfo.h"
#include <zend_exceptions.h>
#include <zend_interfaces.h>
#include <assert.h>
}

using PHP::CodePointBreakIterator;
using icu::RuleBasedBreakIterator;
Expand All @@ -43,7 +41,7 @@ zend_class_entry *CodePointBreakIterator_ce_ptr;
zend_object_handlers BreakIterator_handlers;
/* }}} */

U_CFUNC void breakiterator_object_create(zval *object,
void breakiterator_object_create(zval *object,
BreakIterator *biter, int brand_new)
{
UClassID classId = biter->getDynamicClassID();
Expand All @@ -63,7 +61,7 @@ U_CFUNC void breakiterator_object_create(zval *object,
breakiterator_object_construct(object, biter);
}

U_CFUNC void breakiterator_object_construct(zval *object,
void breakiterator_object_construct(zval *object,
BreakIterator *biter)
{
BreakIterator_object *bio;
Expand Down Expand Up @@ -201,7 +199,7 @@ static zend_object *BreakIterator_object_create(zend_class_entry *ce)
/* {{{ breakiterator_register_BreakIterator_class
* Initialize 'BreakIterator' class
*/
U_CFUNC void breakiterator_register_BreakIterator_class(void)
void breakiterator_register_BreakIterator_class(void)
{
/* Create and register 'BreakIterator' class. */

Expand Down
10 changes: 4 additions & 6 deletions ext/intl/breakiterator/breakiterator_iterators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
#include "breakiterator_iterators.h"
#include "../common/common_enum.h"

extern "C" {
#define USE_BREAKITERATOR_POINTER
#include "breakiterator_class.h"
#include "breakiterator_iterators_arginfo.h"
#include "../intl_convert.h"
#include "../locale/locale.h"
#include <zend_exceptions.h>
#include <zend_interfaces.h>
}

static zend_class_entry *IntlPartsIterator_ce_ptr;

Expand Down Expand Up @@ -101,7 +99,7 @@ static const zend_object_iterator_funcs breakiterator_iterator_funcs = {
NULL, /* get_gc */
};

U_CFUNC zend_object_iterator *_breakiterator_get_iterator(
zend_object_iterator *_breakiterator_get_iterator(
zend_class_entry *ce, zval *object, int by_ref)
{
BreakIterator_object *bio;
Expand Down Expand Up @@ -253,7 +251,7 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv,
((zoi_break_iter_parts*)ii->iterator)->index_right = 0;
}

U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
PHP_METHOD(IntlPartsIterator, getBreakIterator)
{
INTLITERATOR_METHOD_INIT_VARS;

Expand All @@ -264,7 +262,7 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
RETURN_COPY_DEREF(&ii->iterator->data);
}

U_CFUNC PHP_METHOD(IntlPartsIterator, getRuleStatus)
PHP_METHOD(IntlPartsIterator, getRuleStatus)
{
INTLITERATOR_METHOD_INIT_VARS;

Expand All @@ -278,7 +276,7 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getRuleStatus)
Z_OBJ_P(iter), Z_OBJCE_P(iter), NULL, "getrulestatus", return_value);
}

U_CFUNC void breakiterator_register_IntlPartsIterator_class(void)
void breakiterator_register_IntlPartsIterator_class(void)
{
/* Create and register 'BreakIterator' class. */
IntlPartsIterator_ce_ptr = register_class_IntlPartsIterator(IntlIterator_ce_ptr);
Expand Down
6 changes: 2 additions & 4 deletions ext/intl/breakiterator/breakiterator_iterators.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

#include <unicode/umachine.h>

U_CDECL_BEGIN
#include <math.h>
#include <php.h>
U_CDECL_END

typedef enum {
PARTS_ITERATOR_KEY_SEQUENTIAL,
Expand All @@ -33,8 +31,8 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv,
parts_iter_key_type key_type);
#endif

U_CFUNC zend_object_iterator *_breakiterator_get_iterator(
zend_object_iterator *_breakiterator_get_iterator(
zend_class_entry *ce, zval *object, int by_ref);
U_CFUNC void breakiterator_register_IntlPartsIterator_class(void);
void breakiterator_register_IntlPartsIterator_class(void);

#endif
46 changes: 22 additions & 24 deletions ext/intl/breakiterator/breakiterator_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@

#include "breakiterator_iterators.h"

extern "C" {
#include "../php_intl.h"
#define USE_BREAKITERATOR_POINTER 1
#include "breakiterator_class.h"
#include "../locale/locale.h"
#include <zend_exceptions.h>
#include <zend_interfaces.h>
}

using PHP::CodePointBreakIterator;
using icu::BreakIterator;
using icu::Locale;

U_CFUNC PHP_METHOD(IntlBreakIterator, __construct)
PHP_METHOD(IntlBreakIterator, __construct)
{
zend_throw_exception( NULL,
"An object of this type cannot be created with the new operator",
Expand Down Expand Up @@ -70,42 +68,42 @@ static void _breakiter_factory(
breakiterator_object_create(return_value, biter, 1);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, createWordInstance)
PHP_METHOD(IntlBreakIterator, createWordInstance)
{
_breakiter_factory(
&BreakIterator::createWordInstance,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, createLineInstance)
PHP_METHOD(IntlBreakIterator, createLineInstance)
{
_breakiter_factory(
&BreakIterator::createLineInstance,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, createCharacterInstance)
PHP_METHOD(IntlBreakIterator, createCharacterInstance)
{
_breakiter_factory(
&BreakIterator::createCharacterInstance,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, createSentenceInstance)
PHP_METHOD(IntlBreakIterator, createSentenceInstance)
{
_breakiter_factory(
&BreakIterator::createSentenceInstance,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, createTitleInstance)
PHP_METHOD(IntlBreakIterator, createTitleInstance)
{
_breakiter_factory(
&BreakIterator::createTitleInstance,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, createCodePointInstance)
PHP_METHOD(IntlBreakIterator, createCodePointInstance)
{
intl_error_reset(NULL);

Expand All @@ -115,7 +113,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, createCodePointInstance)
breakiterator_object_create(return_value, cpbi, 1);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, getText)
PHP_METHOD(IntlBreakIterator, getText)
{
BREAKITER_METHOD_INIT_VARS;
object = ZEND_THIS;
Expand All @@ -131,7 +129,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getText)
}
}

U_CFUNC PHP_METHOD(IntlBreakIterator, setText)
PHP_METHOD(IntlBreakIterator, setText)
{
UText *ut = NULL;
zend_string *text;
Expand Down Expand Up @@ -200,25 +198,25 @@ static void _breakiter_int32_ret_int32(
RETURN_LONG((zend_long)res);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, first)
PHP_METHOD(IntlBreakIterator, first)
{
_breakiter_no_args_ret_int32(&BreakIterator::first,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, last)
PHP_METHOD(IntlBreakIterator, last)
{
_breakiter_no_args_ret_int32(&BreakIterator::last,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, previous)
PHP_METHOD(IntlBreakIterator, previous)
{
_breakiter_no_args_ret_int32(&BreakIterator::previous,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, next)
PHP_METHOD(IntlBreakIterator, next)
{
zval *arg = NULL;

Expand All @@ -237,7 +235,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, next)
}
}

U_CFUNC PHP_METHOD(IntlBreakIterator, current)
PHP_METHOD(IntlBreakIterator, current)
{
BREAKITER_METHOD_INIT_VARS;
object = ZEND_THIS;
Expand All @@ -251,21 +249,21 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, current)
RETURN_LONG((zend_long)res);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, following)
PHP_METHOD(IntlBreakIterator, following)
{
_breakiter_int32_ret_int32(
&BreakIterator::following,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, preceding)
PHP_METHOD(IntlBreakIterator, preceding)
{
_breakiter_int32_ret_int32(
&BreakIterator::preceding,
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, isBoundary)
PHP_METHOD(IntlBreakIterator, isBoundary)
{
zend_long offset;
BREAKITER_METHOD_INIT_VARS;
Expand All @@ -287,7 +285,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, isBoundary)
RETURN_BOOL((zend_long)res);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, getLocale)
PHP_METHOD(IntlBreakIterator, getLocale)
{
zend_long locale_type;
BREAKITER_METHOD_INIT_VARS;
Expand All @@ -313,7 +311,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getLocale)
RETURN_STRING(locale.getName());
}

U_CFUNC PHP_METHOD(IntlBreakIterator, getPartsIterator)
PHP_METHOD(IntlBreakIterator, getPartsIterator)
{
zend_long key_type = 0;
BREAKITER_METHOD_INIT_VARS;
Expand All @@ -338,7 +336,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getPartsIterator)
object, return_value, (parts_iter_key_type)key_type);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, getErrorCode)
PHP_METHOD(IntlBreakIterator, getErrorCode)
{
BREAKITER_METHOD_INIT_VARS;
object = ZEND_THIS;
Expand All @@ -350,7 +348,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getErrorCode)
RETURN_LONG((zend_long)BREAKITER_ERROR_CODE(bio));
}

U_CFUNC PHP_METHOD(IntlBreakIterator, getErrorMessage)
PHP_METHOD(IntlBreakIterator, getErrorMessage)
{
zend_string* message = NULL;
BREAKITER_METHOD_INIT_VARS;
Expand All @@ -366,7 +364,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getErrorMessage)
RETURN_STR(message);
}

U_CFUNC PHP_METHOD(IntlBreakIterator, getIterator)
PHP_METHOD(IntlBreakIterator, getIterator)
{
ZEND_PARSE_PARAMETERS_NONE();

Expand Down
4 changes: 1 addition & 3 deletions ext/intl/breakiterator/codepointiterator_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@

#include "codepointiterator_internal.h"

extern "C" {
#define USE_BREAKITERATOR_POINTER 1
#include "breakiterator_class.h"
}

using PHP::CodePointBreakIterator;

static inline CodePointBreakIterator *fetch_cpbi(BreakIterator_object *bio) {
return (CodePointBreakIterator*)bio->biter;
}

U_CFUNC PHP_METHOD(IntlCodePointBreakIterator, getLastCodePoint)
PHP_METHOD(IntlCodePointBreakIterator, getLastCodePoint)
{
BREAKITER_METHOD_INIT_VARS;
object = ZEND_THIS;
Expand Down
Loading
Loading