コード例 #1
0
        public static RC MemFinalize(Mem mem, FuncDef func)
        {
            RC rc = RC.OK;

            if (C._ALWAYS(func != null && func.Finalize != null))
            {
                Debug.Assert((mem.Flags & MEM.Null) != 0 || func == mem.u.Def);
                Debug.Assert(mem.Ctx == null || MutexEx.Held(mem.Ctx.Mutex));
                //memset(&ctx, 0, sizeof(ctx));
                FuncContext ctx = new FuncContext();
                ctx.S.Flags = MEM.Null;
                ctx.S.Ctx   = mem.Ctx;
                ctx.Mem     = mem;
                ctx.Func    = func;
                func.Finalize(ctx);              // IMP: R-24505-23230
                Debug.Assert((mem.Flags & MEM.Dyn) == 0 && mem.Del == null);
                C._tagfree(mem.Ctx, ref mem.Z_); //: mem->Malloc);
                ctx.S._memcpy(ref mem);
                rc = ctx.IsError;
            }
            return(rc);
        }
コード例 #2
0
ファイル: Vdbe+Mem.cs プロジェクト: BclEx/GpuStructs
 public static RC MemFinalize(Mem mem, FuncDef func)
 {
     RC rc = RC.OK;
     if (C._ALWAYS(func != null && func.Finalize != null))
     {
         Debug.Assert((mem.Flags & MEM.Null) != 0 || func == mem.u.Def);
         Debug.Assert(mem.Ctx == null || MutexEx.Held(mem.Ctx.Mutex));
         //memset(&ctx, 0, sizeof(ctx));
         FuncContext ctx = new FuncContext();
         ctx.S.Flags = MEM.Null;
         ctx.S.Ctx = mem.Ctx;
         ctx.Mem = mem;
         ctx.Func = func;
         func.Finalize(ctx); // IMP: R-24505-23230
         Debug.Assert((mem.Flags & MEM.Dyn) == 0 && mem.Del == null);
         C._tagfree(mem.Ctx, ref mem.Z_); //: mem->Malloc);
         ctx.S._memcpy(ref mem);
         rc = ctx.IsError;
     }
     return rc;
 }