// ReturnSubs returns substitutions to the pool. USE WITH CAUTION.
940
func ReturnSubs(sub Subs) {
	switch s := sub.(type) {
	case mSubs:
		for k := range s {
			delete(s, k)
		}
		mSubPool.Put(sub)
	case *sSubs:
		size := cap(s.s) - 2
		if size > 0 && size < poolSize+1 {
			// reset to empty
			for i := range s.s {
				s.s[i] = Substitution{}
			}

			s.s = s.s[:size]
			sSubPool[size-1].Put(sub)
		}
	}
}
211515
func ReturnTypes(ts Types) {
	if size := cap(ts); size > 0 && size < poolSize+1 {
		ts = ts[:cap(ts)]
		for i := range ts {
			ts[i] = nil
		}
		typesPool[size-1].Put(ts)
	}
}
609460
func (this *Context) Sub(s interface{}) *Context {
    isEmpty := this.Empty()

    switch t := s.(type) {
    case string:
        i, ok := this.Names[t]
        if !ok {
            panic("submatch not exist: " + t)
        }

        var result *Context
        if isEmpty {
            result = this.createEmptySub()
        } else {
            result = NewDoc(this.List[i])
            result.Parent = this
        }

        return result
    case int:
        if len(this.List) < t + 1 && !isEmpty {
            panic(fmt.Sprintf("submatch index not exist: %d", t))
        }

        var result *Context
        if isEmpty {
            result = this.createEmptySub()
        } else {
            result = NewDoc(this.List[t])
            result.Parent = this
        }

        return result
    default:
        panic(fmt.Sprintf("invalid sub index: %v", s))
    }
}
578962
func (r Email_Subscription_Group) GetSubscriptions() (resp []datatypes.Email_Subscription, err error) {
	err = r.Session.DoRequest("SoftLayer_Email_Subscription_Group", "getSubscriptions", nil, &r.Options, &resp)
	return
}
998344
func (it *And) SubIterators() []graph.Iterator {
	iters := make([]graph.Iterator, 0, len(it.internalIterators)+1)
	if it.primaryIt != nil {
		iters = append(iters, it.primaryIt)
	}
	iters = append(iters, it.internalIterators...)
	return iters
}
300772
func GetSubsystems() []string {
	loggerMutex.RLock()
	defer loggerMutex.RUnlock()
	subs := make([]string, 0, len(loggers))

	for k := range loggers {
		subs = append(subs, k)
	}
	return subs
}
556213
func (api *API) GetPeerSubscriptions() map[string][]string {
	//create the empty map
	pstreams := make(map[string][]string)

	//iterate all streamer peers
	api.streamer.peersMu.RLock()
	defer api.streamer.peersMu.RUnlock()

	for id, p := range api.streamer.peers {
		var streams []string
		//every peer has a map of stream servers
		//every stream server represents a subscription
		p.serverMu.RLock()
		for s := range p.servers {
			//append the string representation of the stream
			//to the list for this peer
			streams = append(streams, s.String())
		}
		p.serverMu.RUnlock()
		//set the array of stream servers to the map
		pstreams[id.String()] = streams
	}
	return pstreams
}
1048068
func AddSubnets(ctx context.ProviderCallContext, api NetworkBacking, args params.AddSubnetsParams) (params.ErrorResults, error) {
	results := params.ErrorResults{
		Results: make([]params.ErrorResult, len(args.Subnets)),
	}

	if len(args.Subnets) == 0 {
		return results, nil
	}

	cache := NewAddSubnetsCache(api)
	for i, arg := range args.Subnets {
		err := addOneSubnet(ctx, api, arg, cache)
		if err != nil {
			results.Results[i].Error = common.ServerError(err)
		}
	}
	return results, nil
}
724132
func Sub(a, b []float32) {
	b = b[:len(a)]
	for i, v := range a {
		a[i] = v - b[i]
	}
}
992447
func genStubs(recv string, fns []Func) []byte {
	var buf bytes.Buffer
	for _, fn := range fns {
		meth := Method{Recv: recv, Func: fn}
		tmpl.Execute(&buf, meth)
	}

	pretty, err := format.Source(buf.Bytes())
	if err != nil {
		panic(err)
	}
	return pretty
}
730471
func returnHashes(hashes []common.Hash) []common.Hash {
	if hashes == nil {
		return []common.Hash{}
	}
	return hashes
}
903560
func (c *client) getSubsCopy() []*subState {
	subs := make([]*subState, len(c.subs))
	copy(subs, c.subs)
	return subs
}
297566
func ReturnTypes(t interface{}) []string {
	if reflect.TypeOf(t).Kind() != reflect.Func {
		// Invalid provide, will be logged as an error.
		return []string{}
	}

	rtypes := []string{}
	ft := reflect.ValueOf(t).Type()

	for i := 0; i < ft.NumOut(); i++ {
		t := ft.Out(i)

		traverseOuts(key{t: t}, func(s string) {
			rtypes = append(rtypes, s)
		})
	}

	return rtypes
}
1091551
func (api *NetworksAPI) GetSubnets(networkID string, options *SubnetGetOptions) (result *Subnets, err error) {
	uri := api.client.Endpoint + networkUrl + networkID + "/subnets"
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
	if err != nil {
		return
	}

	result = &Subnets{}
	err = json.Unmarshal(res, result)
	return
}
87853
func (mc MongoClient) GetSubscriptions() ([]contract.Subscription, error) {
	return mc.getSubscriptions(bson.M{})
}
1319850
func (api *subnetsAPI) ListSubnets(args params.SubnetsFilters) (results params.ListSubnetsResults, err error) {
	if err := api.checkCanRead(); err != nil {
		return params.ListSubnetsResults{}, err
	}

	return networkingcommon.ListSubnets(api.backing, args)
}
938158
func (u *User) GetSubscriptionsURL() string {
	if u == nil || u.SubscriptionsURL == nil {
		return ""
	}
	return *u.SubscriptionsURL
}