Typehinting merge #50

已合并
belliash 2019-04-17 11:27:52 +02:00 将 298 次代码提交从 typehinting合并至 master
修改 2 个文件,包含 18 行新增12 行删除
仅显示提交 2db1954779 的更改 - 显示所有提交

查看文件

@@ -105,9 +105,11 @@ static sxi32 MemObjCallClassCastMethod(
sxu32 nLen, /* Method name length */
ph7_value *pResult /* OUT: Store the return value of the magic method here */
) {
ph7_class_method *pMethod;
ph7_class_method *pMethod = 0;
/* Check if the method is available */
pMethod = PH7_ClassExtractMethod(pThis->pClass, zMethod, nLen);
if(pThis) {
pMethod = PH7_ClassExtractMethod(pThis->pClass, zMethod, nLen);
}
if(pMethod == 0) {
/* No such method */
return SXERR_NOTFOUND;
@@ -757,12 +759,14 @@ PH7_PRIVATE sxi32 PH7_MemObjStore(ph7_value *pSrc, ph7_value *pDest) {
ph7_class_instance *pObj = 0;
ph7_hashmap *pMap = 0;
sxi32 rc;
if(pSrc->iFlags & MEMOBJ_HASHMAP) {
/* Increment reference count */
((ph7_hashmap *)pSrc->x.pOther)->iRef++;
} else if(pSrc->iFlags & MEMOBJ_OBJ) {
/* Increment reference count */
((ph7_class_instance *)pSrc->x.pOther)->iRef++;
if(pSrc->x.pOther) {
if(pSrc->iFlags & MEMOBJ_HASHMAP) {
/* Increment reference count */
((ph7_hashmap *)pSrc->x.pOther)->iRef++;
} else if(pSrc->iFlags & MEMOBJ_OBJ) {
/* Increment reference count */
((ph7_class_instance *)pSrc->x.pOther)->iRef++;
}
}
if(pDest->iFlags & MEMOBJ_HASHMAP) {
pMap = (ph7_hashmap *)pDest->x.pOther;

查看文件

@@ -717,10 +717,12 @@ static void PH7_ClassInstanceRelease(ph7_class_instance *pThis) {
* If the reference count reaches zero,release the whole instance.
*/
PH7_PRIVATE void PH7_ClassInstanceUnref(ph7_class_instance *pThis) {
pThis->iRef--;
if(pThis->iRef < 1) {
/* No more reference to this instance */
PH7_ClassInstanceRelease(&(*pThis));
if(pThis) {
pThis->iRef--;
if(pThis->iRef < 1) {
/* No more reference to this instance */
PH7_ClassInstanceRelease(&(*pThis));
}
}
}
/*