projects
/
awesomized
/
ext-ion
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
e1d8621
)
fix ion type arguments
author
Michael Wallner
<mike@php.net>
Wed, 22 Dec 2021 17:30:28 +0000
(18:30 +0100)
committer
Michael Wallner
<mike@php.net>
Wed, 22 Dec 2021 17:30:28 +0000
(18:30 +0100)
ion.c
patch
|
blob
|
history
ion_private.h
patch
|
blob
|
history
diff --git
a/ion.c
b/ion.c
index 45f34b86d425ae776a4e47b1ef605171dd338384..c252457b901c80fc60b1eb18b06dce72e45debcc 100644
(file)
--- a/
ion.c
+++ b/
ion.c
@@
-924,7
+924,7
@@
static ZEND_METHOD(ion_Reader_Reader, readNull)
ION_TYPE typ;
ION_CHECK(ion_reader_read_null(obj->reader, &typ));
ION_TYPE typ;
ION_CHECK(ion_reader_read_null(obj->reader, &typ));
- RETURN_
OBJ_COPY(php_ion_type_fetch(typ)
);
+ RETURN_
IONTYPE(typ
);
}
static ZEND_METHOD(ion_Reader_Reader, readBool)
{
}
static ZEND_METHOD(ion_Reader_Reader, readBool)
{
@@
-1310,9
+1310,7
@@
static ZEND_METHOD(ion_Writer_Writer, writeTypedNull)
Z_PARAM_OBJ_OF_CLASS(typ_obj, ce_Type)
ZEND_PARSE_PARAMETERS_END();
Z_PARAM_OBJ_OF_CLASS(typ_obj, ce_Type)
ZEND_PARSE_PARAMETERS_END();
- php_ion_type *typ = php_ion_obj(type, typ_obj);
- OBJ_CHECK(typ);
- ION_CHECK(ion_writer_write_typed_null(obj->writer, php_ion_obj(type, typ)->typ));
+ ION_CHECK(ion_writer_write_typed_null(obj->writer, ion_type_from_enum(typ_obj)));
}
static ZEND_METHOD(ion_Writer_Writer, writeBool)
{
}
static ZEND_METHOD(ion_Writer_Writer, writeBool)
{
@@
-1472,9
+1470,7
@@
static ZEND_METHOD(ion_Writer_Writer, startLob)
Z_PARAM_OBJ_OF_CLASS(typ_obj, ce_Type)
ZEND_PARSE_PARAMETERS_END();
Z_PARAM_OBJ_OF_CLASS(typ_obj, ce_Type)
ZEND_PARSE_PARAMETERS_END();
- php_ion_type *typ = php_ion_obj(type, typ_obj);
- OBJ_CHECK(typ);
- ION_CHECK(ion_writer_start_lob(obj->writer, php_ion_obj(type, typ)->typ));
+ ION_CHECK(ion_writer_start_lob(obj->writer, ion_type_from_enum(typ_obj)));
}
static ZEND_METHOD(ion_Writer_Writer, appendLob)
{
}
static ZEND_METHOD(ion_Writer_Writer, appendLob)
{
@@
-1507,9
+1503,7
@@
static ZEND_METHOD(ion_Writer_Writer, startContainer)
Z_PARAM_OBJ_OF_CLASS(typ_obj, ce_Type)
ZEND_PARSE_PARAMETERS_END();
Z_PARAM_OBJ_OF_CLASS(typ_obj, ce_Type)
ZEND_PARSE_PARAMETERS_END();
- php_ion_type *typ = php_ion_obj(type, typ_obj);
- OBJ_CHECK(typ);
- ION_CHECK(ion_writer_start_container(obj->writer, php_ion_obj(type, typ)->typ));
+ ION_CHECK(ion_writer_start_container(obj->writer, ion_type_from_enum(typ_obj)));
}
static ZEND_METHOD(ion_Writer_Writer, finishContainer)
{
}
static ZEND_METHOD(ion_Writer_Writer, finishContainer)
{
@@
-1833,7
+1827,7
@@
PHP_MINIT_FUNCTION(ion)
ce_Timestamp_Precision = register_class_ion_Timestamp_Precision();
// Type
ce_Timestamp_Precision = register_class_ion_Timestamp_Precision();
// Type
-
php_ion_register(type, Type
);
+
ce_Type = register_class_ion_Type(
);
// Writer
ce_Writer = register_class_ion_Writer();
// Writer
ce_Writer = register_class_ion_Writer();
diff --git
a/ion_private.h
b/ion_private.h
index 0831df39c032acf5fc1426cbb1bec74ad13d8b67..5993af0cd2efe6c2c9890d7d5b2ede1fd6853579 100644
(file)
--- a/
ion_private.h
+++ b/
ion_private.h
@@
-413,13
+413,6
@@
static inline void update_property_obj(zend_object *obj, const char *n, size_t l
zend_update_property(obj->ce, obj, n, l, &zobj);
}
zend_update_property(obj->ce, obj, n, l, &zobj);
}
-typedef struct php_ion_type {
- ION_TYPE typ;
- zend_object std;
-} php_ion_type;
-
-php_ion_decl(type, Type);
-
#define RETURN_IONTYPE(typ) do { \
zend_object *__zo = php_ion_type_fetch(typ); \
if (UNEXPECTED(!__zo)) { \
#define RETURN_IONTYPE(typ) do { \
zend_object *__zo = php_ion_type_fetch(typ); \
if (UNEXPECTED(!__zo)) { \
@@
-440,6
+433,11
@@
static inline zend_object *php_ion_type_fetch(ION_TYPE typ)
return zend_enum_get_case(ce_Type, Z_STR_P(ztype));
}
return zend_enum_get_case(ce_Type, Z_STR_P(ztype));
}
+static inline ION_TYPE ion_type_from_enum(zend_object *zo)
+{
+ return Z_LVAL_P(zend_enum_fetch_case_value(zo));
+}
+
typedef struct php_ion_symbol_iloc {
ION_SYMBOL_IMPORT_LOCATION loc;
zend_string *name;
typedef struct php_ion_symbol_iloc {
ION_SYMBOL_IMPORT_LOCATION loc;
zend_string *name;