mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Merge Sterling's patches from ZE1
This commit is contained in:
parent
e74c4e0a45
commit
d87fa22532
3 changed files with 27 additions and 14 deletions
|
@ -857,8 +857,8 @@ static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, t
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container->type == IS_OBJECT &&
|
if (container->type == IS_OBJECT &&
|
||||||
(type == BP_VAR_W && Z_OBJCE_P(container)->handle_property_set ||
|
((type == BP_VAR_W && Z_OBJCE_P(container)->handle_property_set) ||
|
||||||
type != BP_VAR_W && Z_OBJCE_P(container)->handle_property_get)) {
|
(type != BP_VAR_W && Z_OBJCE_P(container)->handle_property_get))) {
|
||||||
zend_overloaded_element overloaded_element;
|
zend_overloaded_element overloaded_element;
|
||||||
|
|
||||||
Ts[result->u.var].EA.data.overloaded_element.object = container;
|
Ts[result->u.var].EA.data.overloaded_element.object = container;
|
||||||
|
|
|
@ -64,32 +64,34 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element)
|
||||||
|
|
||||||
|
|
||||||
#define DEL_LLIST_ELEMENT(current, l) \
|
#define DEL_LLIST_ELEMENT(current, l) \
|
||||||
if (current->prev) {\
|
if ((current)->prev) {\
|
||||||
current->prev->next = current->next;\
|
(current)->prev->next = (current)->next;\
|
||||||
} else {\
|
} else {\
|
||||||
l->head = current->next;\
|
(l)->head = (current)->next;\
|
||||||
}\
|
}\
|
||||||
if (current->next) {\
|
if ((current)->next) {\
|
||||||
current->next->prev = current->prev;\
|
(current)->next->prev = (current)->prev;\
|
||||||
} else {\
|
} else {\
|
||||||
l->tail = current->prev;\
|
(l)->tail = (current)->prev;\
|
||||||
}\
|
}\
|
||||||
if (l->dtor) {\
|
if ((l)->dtor) {\
|
||||||
l->dtor(current->data);\
|
(l)->dtor((current)->data);\
|
||||||
pefree(current, l->persistent);\
|
pefree((current), (l)->persistent);\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2))
|
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2))
|
||||||
{
|
{
|
||||||
zend_llist_element *current=l->head;
|
zend_llist_element *current=l->head;
|
||||||
|
zend_llist_element *next;
|
||||||
|
|
||||||
while (current) {
|
while (current) {
|
||||||
|
next = current->next;
|
||||||
if (compare(current->data, element)) {
|
if (compare(current->data, element)) {
|
||||||
DEL_LLIST_ELEMENT(current, l);
|
DEL_LLIST_ELEMENT(current, l);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
current = current->next;
|
current = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,17 +118,28 @@ ZEND_API void zend_llist_clean(zend_llist *l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ZEND_API void zend_llist_remove_tail(zend_llist *l)
|
ZEND_API void *zend_llist_remove_tail(zend_llist *l)
|
||||||
{
|
{
|
||||||
zend_llist_element *old_tail;
|
zend_llist_element *old_tail;
|
||||||
|
void *data;
|
||||||
|
|
||||||
if ((old_tail = l->tail)) {
|
if ((old_tail = l->tail)) {
|
||||||
if (l->tail->prev) {
|
if (l->tail->prev) {
|
||||||
l->tail->prev->next = NULL;
|
l->tail->prev->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save the data, this doesn't get free'd,
|
||||||
|
* the pointer is just removed from the list
|
||||||
|
*/
|
||||||
|
data = old_tail->data;
|
||||||
|
|
||||||
l->tail = l->tail->prev;
|
l->tail = l->tail->prev;
|
||||||
pefree(old_tail, l->persistent);
|
pefree(old_tail, l->persistent);
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
|
||||||
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2));
|
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2));
|
||||||
ZEND_API void zend_llist_destroy(zend_llist *l);
|
ZEND_API void zend_llist_destroy(zend_llist *l);
|
||||||
ZEND_API void zend_llist_clean(zend_llist *l);
|
ZEND_API void zend_llist_clean(zend_llist *l);
|
||||||
ZEND_API void zend_llist_remove_tail(zend_llist *l);
|
ZEND_API void *zend_llist_remove_tail(zend_llist *l);
|
||||||
ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
|
ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
|
||||||
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
|
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
|
||||||
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
|
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue