コード例 #1
0
ファイル: wslua_field.c プロジェクト: HeartFlying/wireshark
/* Gets registered as metamethod automatically by WSLUA_REGISTER_META */
static int FieldInfo__gc(lua_State* L) {
    FieldInfo fi = toFieldInfo(L,1);

    if (!fi) return 0;

    if (!fi->expired)
        fi->expired = TRUE;
    else
        /* do NOT free fi->ws_fi */
        g_free(fi);

    return 0;
}
コード例 #2
0
ファイル: wslua_field.c プロジェクト: MultipathDTLS/wireshark
    if (l->ws_fi->ds_tvb != r->ws_fi->ds_tvb) {
        WSLUA_ERROR(FieldInfo__lt,"Data source must be the same for both fields");
        return 0;
    }

    if (r->ws_fi->start + r->ws_fi->length < l->ws_fi->start) {
        lua_pushboolean(L,1);
    } else {
        lua_pushboolean(L,0);
    }
    return 1;
}

/* Gets registered as metamethod automatically by WSLUA_REGISTER_META */
static int FieldInfo__gc(lua_State* L _U_) {
    FieldInfo fi = toFieldInfo(L,1);

    if (!fi) return 0;

    if (!fi->expired)
        fi->expired = TRUE;
    else
        /* do NOT free fi->ws_fi */
        g_free(fi);

    return 0;
}

/* This table is ultimately registered as a sub-table of the class' metatable,
 * and if __index/__newindex is invoked then it calls the appropriate function
 * from this table for getting/setting the members.