// CFDictionaryToMap converts CFDictionaryRef to a map.
500768
func CFDictionaryToMap(cfDict C.CFDictionaryRef) (m map[C.CFTypeRef]uintptr) {
	count := C.CFDictionaryGetCount(cfDict)
	if count > 0 {
		keys := make([]C.CFTypeRef, count)
		values := make([]C.CFTypeRef, count)
		C.CFDictionaryGetKeysAndValues(cfDict, (*unsafe.Pointer)(&keys[0]), (*unsafe.Pointer)(&values[0]))
		m = make(map[C.CFTypeRef]uintptr, count)
		for i := C.CFIndex(0); i < count; i++ {
			k := keys[i]
			v := values[i]
			m[k] = uintptr(v)
		}
	}
	return
}
62288
func FuncMap(I18n *i18n.I18n, locale string, enableInlineEdit bool) template.FuncMap {
	return template.FuncMap{
		"t": InlineEdit(I18n, locale, enableInlineEdit),
	}
}
1311349
func (c *Config) ReadStringListToMapDefault(key, defaultValue string) map[string]struct{} {
	val, ok := c.Options[key]
	if !ok {
		val = defaultValue
	}

	list := make(map[string]struct{})
	if val != "" {
		for _, e := range strings.Split(val, ",") {
			trimmed := strings.TrimSpace(e)
			list[trimmed] = struct{}{}
		}
	}
	return list
}
987788
func (s *Application) FuncMapCopyTo(m map[string]interface{}) *Application {
	for k, v := range s.FuncMap {
		m[k] = v
	}
	return s
}
886937
func addToMap(cg comparable, result map[string]comparable) error {
	var fqPath string

	switch {
	case cg.ConfigGroup != nil:
		fqPath = groupPrefix
	case cg.ConfigValue != nil:
		fqPath = valuePrefix
	case cg.ConfigPolicy != nil:
		fqPath = policyPrefix
	}

	if err := validateConfigID(cg.key); err != nil {
		return fmt.Errorf("Illegal characters in key: %s", fqPath)
	}

	if len(cg.path) == 0 {
		fqPath += pathSeparator + cg.key
	} else {
		fqPath += pathSeparator + strings.Join(cg.path, pathSeparator) + pathSeparator + cg.key
	}

	logger.Debugf("Adding to config map: %s", fqPath)

	result[fqPath] = cg

	return nil
}
1356678
func (c *Config) ReadStringListToMap(key string) map[string]struct{} {
	s := strings.TrimSpace(c.Read(key))
	list := make(map[string]struct{})
	if s != "" {
		for _, e := range strings.Split(s, ",") {
			trimmed := strings.TrimSpace(e)
			list[trimmed] = struct{}{}
		}
	}
	return list
}
749736
func (s Session) sessionDataFromMap(key string) (result interface{}, err error) {
	var mapValue map[string]interface{}
	uncastMapValue, found := s[SessionMapKeyName]
	if !found {
		mapValue = map[string]interface{}{}
		s[SessionMapKeyName] = mapValue
	} else if mapValue, found = uncastMapValue.(map[string]interface{}); !found {
		// Unusual means that the value in the session was not expected
		sessionLog.Errorf("Unusual means that the value in the session was not expected", "session", uncastMapValue)
		mapValue = map[string]interface{}{}
		s[SessionMapKeyName] = mapValue
	}

	// Try to extract the key from the map
	result, found = mapValue[key]
	if !found {
		result, err = s.convertSessionData(key, nil)
		if err == nil {
			mapValue[key] = result
		}
	}
	return
}
307386
func optArgsToMap(optArgs OptArgs) map[string]interface{} {
	data, err := encode(optArgs)

	if err == nil && data != nil {
		if m, ok := data.(map[string]interface{}); ok {
			return m
		}
	}

	return map[string]interface{}{}
}
956591
func TabletToMapKey(tablet *topodatapb.Tablet) string {
	parts := make([]string, 0, 1)
	for name, port := range tablet.PortMap {
		parts = append(parts, netutil.JoinHostPort(name, port))
	}
	sort.Strings(parts)
	parts = append([]string{tablet.Hostname}, parts...)
	return strings.Join(parts, ",")
}
424975
func valuesToMap(values map[string][]string) map[string]interface{} {
	ret := make(map[string]interface{})

	for key, value := range values {
		if len(value) > 0 {
			ret[key] = value[0]
		}
	}

	return ret
}
718118
func CSVToMaps(reader io.Reader) ([]map[string]string, error) {
	r := csv.NewReader(reader)
	rows := []map[string]string{}
	var header []string
	for {
		record, err := r.Read()
		if err == io.EOF {
			break
		}
		if err != nil {
			return nil, err
		}
		if header == nil {
			header = record
		} else {
			dict := map[string]string{}
			for i := range header {
				dict[header[i]] = record[i]
			}
			rows = append(rows, dict)
		}
	}
	return rows, nil
}
575309
func ParseArgumentListToMap(arguments []string) map[string]string {
	resultingMap := map[string]string{}
	for i, arg := range arguments {
		key, val, err := parseArgument(arg)

		// Ignore if the first argument doesn't satisfy the criteria, it's most often the binary name
		// Warn in all other cases, but don't error out. This can happen only if the user has edited the argument list by hand, so they might know what they are doing
		if err != nil {
			if i != 0 {
				fmt.Printf("[kubeadm] WARNING: The component argument %q could not be parsed correctly. The argument must be of the form %q. Skipping...\n", arg, "--")
			}
			continue
		}

		resultingMap[key] = val
	}
	return resultingMap
}
597354
func ToMap(err error) map[string]interface{} {
	var result map[string]interface{}

	// Add context if provided
	child, ok := err.(HasContext)
	if !ok {
		return result
	}

	if result == nil {
		return child.Context()
	}

	// Append the context map to our results
	for key, value := range child.Context() {
		result[key] = value
	}
	return result
}
346119
func parseMetadata(md map[string]*string) (map[string]interface{}, error) {
	m := make(map[string]interface{}, len(md))
	for key, value := range md {
		k := strings.ToLower(key)
		m[k] = *value
	}
	return m, nil
}
1100567
func resultToMap(qr *sqltypes.Result) (map[string]string, error) {
	if len(qr.Rows) == 0 {
		// The query succeeded, but there is no data.
		return nil, nil
	}
	if len(qr.Rows) > 1 {
		return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "query returned %d rows, expected 1", len(qr.Rows))
	}
	if len(qr.Fields) != len(qr.Rows[0]) {
		return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "query returned %d column names, expected %d", len(qr.Fields), len(qr.Rows[0]))
	}

	result := make(map[string]string, len(qr.Fields))
	for i, field := range qr.Fields {
		result[field.Name] = qr.Rows[0][i].ToString()
	}
	return result, nil
}
1148941
func (o *rawSet) RowsToMap(result *Params, keyCol, valueCol string) (int64, error) {
	return o.queryRowsTo(result, keyCol, valueCol)
}
1131963
func fieldNameMapping(obj interface{}) map[string]string {
	st := reflect.TypeOf(obj)
	fl := st.NumField()

	jsonToForce := make(map[string]string, fl)

	for i := 0; i < fl; i++ {
		sf := st.Field(i)
		jName := strings.SplitN(sf.Tag.Get("json"), ",", 2)[0]
		fName := strings.SplitN(sf.Tag.Get("force"), ",", 2)[0]

		if jName == "-" {
			continue
		}

		if fName == "-" {
			continue
		}

		if jName == "" {
			jName = sf.Name
		}

		if fName == "" {
			fName = sf.Name
		}

		jsonToForce[jName] = fName
	}

	for k, v := range baseFieldNameMap {
		jsonToForce[k] = v
	}

	return jsonToForce
}