Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Variant计数管理设计 #23

Closed
owenliang opened this issue Jul 25, 2017 · 1 comment
Closed

关于Variant计数管理设计 #23

owenliang opened this issue Jul 25, 2017 · 1 comment

Comments

@owenliang
Copy link
Collaborator

能否把Variant关于reference的逻辑直接干掉,统一走一致的引用计数管理?

    Variant(zval *v)
    {
        reference = false;
        ref_val = NULL;
        memcpy(&val, v, sizeof(zval));
        zval_add_ref(&val);
    }
    Variant(zval *v, bool ref)
    {
        ref_val = v;
        reference = ref;
    }

第二个构造函数引入了ref的概念,感觉很别扭。

问题是:能否直接干掉ref的设计,统一走zval的引用计数管理,这样会带来什么问题。

@matyhtf 辛苦解释下~

@matyhtf
Copy link
Member

matyhtf commented Jul 26, 2017

扩展函数的输入输出需要依赖这个,需要直接引用 PHP 层的 zval *,不能进行复制。否则无法实现直接操作。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants