Skip to content

Commit

Permalink
Ground code for [] on maps
Browse files Browse the repository at this point in the history
  • Loading branch information
colder committed Sep 6, 2011
1 parent 3466415 commit c1bccc3
Show file tree
Hide file tree
Showing 3 changed files with 317 additions and 8 deletions.
10 changes: 6 additions & 4 deletions php_weakref.c
Expand Up @@ -29,15 +29,17 @@
#include "wr_weakmap.h" #include "wr_weakmap.h"
#include "php_weakref.h" #include "php_weakref.h"


void wr_store_init(TSRMLS_D) { void wr_store_init(TSRMLS_D) /* {{{ */
{
wr_store *store = emalloc(sizeof(wr_store)); wr_store *store = emalloc(sizeof(wr_store));
store->objs = emalloc(sizeof(wr_store_data)); store->objs = emalloc(sizeof(wr_store_data));
store->size = 1; store->size = 1;


WR_G(store) = store; WR_G(store) = store;
} } /* }}} */


void wr_store_destroy(TSRMLS_D) { void wr_store_destroy(TSRMLS_D) /* {{{ */
{
wr_store *store = WR_G(store); wr_store *store = WR_G(store);


if (store->objs != NULL) { if (store->objs != NULL) {
Expand All @@ -47,7 +49,7 @@ void wr_store_destroy(TSRMLS_D) {
efree(store); efree(store);


WR_G(store) = NULL; WR_G(store) = NULL;
} } /* }}} */


void wr_store_dtor(void *object, zend_object_handle ref_handle TSRMLS_DC) /* {{{ */ void wr_store_dtor(void *object, zend_object_handle ref_handle TSRMLS_DC) /* {{{ */
{ {
Expand Down
5 changes: 5 additions & 0 deletions php_weakref.h
Expand Up @@ -52,6 +52,11 @@ typedef struct _wr_weakref_object {


typedef struct _wr_weakmap_object { typedef struct _wr_weakmap_object {
zend_object std; zend_object std;
zend_function *fptr_offset_get;
zend_function *fptr_offset_set;
zend_function *fptr_offset_has;
zend_function *fptr_offset_del;
zend_function *fptr_count;
} wr_weakmap_object; } wr_weakmap_object;


typedef void (*wr_ref_dtor)(void *object, zend_object *wref_obj TSRMLS_DC); typedef void (*wr_ref_dtor)(void *object, zend_object *wref_obj TSRMLS_DC);
Expand Down

0 comments on commit c1bccc3

Please sign in to comment.