func cMechanismList(m []*Mechanism) (arena, C.CK_MECHANISM_PTR, C.CK_ULONG) { var arena arena if len(m) == 0 { return nil, nil, 0 } pm := make([]C.CK_MECHANISM, len(m)) for i := 0; i < len(m); i++ { pm[i].mechanism = C.CK_MECHANISM_TYPE(m[i].Mechanism) if m[i].Parameter == nil { continue } pm[i].pParameter, pm[i].ulParameterLen = arena.Allocate(m[i].Parameter) } return arena, C.CK_MECHANISM_PTR(&pm[0]), C.CK_ULONG(len(m)) }
func cMechanismList(m []*Mechanism) (C.CK_MECHANISM_PTR, C.CK_ULONG) { if len(m) == 0 { return nil, 0 } pm := make([]C.CK_MECHANISM, len(m)) for i := 0; i < len(m); i++ { pm[i].mechanism = C.CK_MECHANISM_TYPE(m[i].Mechanism) if m[i].Parameter == nil { continue } pm[i].pParameter = C.CK_VOID_PTR(&(m[i].Parameter[0])) pm[i].ulParameterLen = C.CK_ULONG(len(m[i].Parameter)) } return C.CK_MECHANISM_PTR(&pm[0]), C.CK_ULONG(len(m)) }