// addKeyString adds a new key binding string to XUtil.Keystrings.
// The invariant is that each key string appears once and only once.
185831
func addKeyString(xu *xgbutil.XUtil, callback xgbutil.CallbackKey,
	evtype int, win xproto.Window, keyStr string, grab bool) {

	xu.KeybindsLck.Lock()
	defer xu.KeybindsLck.Unlock()

	k := xgbutil.KeyString{
		Str:      keyStr,
		Callback: callback,
		Evtype:   evtype,
		Win:      win,
		Grab:     grab,
	}
	xu.Keystrings = append(xu.Keystrings, k)
}
805729
func (s *StreamEncoder) AddString(v string) {
	s.Encoder.writeByte('"')
	s.Encoder.writeString(v)
	s.Encoder.writeByte('"')
	s.Encoder.writeByte(s.delimiter)
}
191646
func (d *DiskEditValue) AddSSHKeyByString(key string) {
	if d.SSHKeys == nil {
		d.SSHKeys = []*SSHKey{}
	}
	d.SSHKeys = append(d.SSHKeys, &SSHKey{PublicKey: key})
}
1261473
func (f *BloomFilter) AddString(data string) *BloomFilter {
	return f.Add([]byte(data))
}
671845
func (s *Stack) PushString(value string) (*Item, error) {
	return s.Push([]byte(value))
}
1159622
func (c *keyValueChanger) Add(k string, v interface{}) error {
	if c.err != nil {
		return c.err
	}
	_, err := c.node.addChild(keyValue{k, v})
	return err
}
303045
func (b *Buffer) AppendString(data string) {
	for len(data) > 0 {
		if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined.
			b.EnsureSpace(1)
		}

		sz := cap(b.Buf) - len(b.Buf)
		if sz > len(data) {
			sz = len(data)
		}

		b.Buf = append(b.Buf, data[:sz]...)
		data = data[sz:]
	}
}
707145
func (addr AddrWithShort) ToString() string {
	return fmt.Sprintf("%s:%d", addr.Host, addr.Port)
}
417048
func parseKeyString(content string) (string, error) {
	// Transform all legal line endings to a single "\n"

	// Replace all windows full new lines ("\r\n")
	content = strings.Replace(content, "\r\n", "\n", -1)

	// Replace all windows half new lines ("\r"), if it happen not to match replace above
	content = strings.Replace(content, "\r", "\n", -1)

	// Replace ending new line as its may cause unwanted behaviour (extra line means not a single line key | OpenSSH key)
	content = strings.TrimRight(content, "\n")

	// split lines
	lines := strings.Split(content, "\n")

	var keyType, keyContent, keyComment string

	if len(lines) == 1 {
		// Parse OpenSSH format.
		parts := strings.SplitN(lines[0], " ", 3)
		switch len(parts) {
		case 0:
			return "", errors.New("empty key")
		case 1:
			keyContent = parts[0]
		case 2:
			keyType = parts[0]
			keyContent = parts[1]
		default:
			keyType = parts[0]
			keyContent = parts[1]
			keyComment = parts[2]
		}

		// If keyType is not given, extract it from content. If given, validate it.
		t, err := extractTypeFromBase64Key(keyContent)
		if err != nil {
			return "", fmt.Errorf("extractTypeFromBase64Key: %v", err)
		}
		if len(keyType) == 0 {
			keyType = t
		} else if keyType != t {
			return "", fmt.Errorf("key type and content does not match: %s - %s", keyType, t)
		}
	} else {
		// Parse SSH2 file format.
		continuationLine := false

		for _, line := range lines {
			// Skip lines that:
			// 1) are a continuation of the previous line,
			// 2) contain ":" as that are comment lines
			// 3) contain "-" as that are begin and end tags
			if continuationLine || strings.ContainsAny(line, ":-") {
				continuationLine = strings.HasSuffix(line, "\\")
			} else {
				keyContent = keyContent + line
			}
		}

		t, err := extractTypeFromBase64Key(keyContent)
		if err != nil {
			return "", fmt.Errorf("extractTypeFromBase64Key: %v", err)
		}
		keyType = t
	}
	return keyType + " " + keyContent + " " + keyComment, nil
}
46020
func (kv KeyValue) String() string {
	return fmt.Sprintf("%s = %v", kv.Key, kv.Value)
}
208000
func (k *Key) MustString(defaultVal string) string {
	val := k.String()
	if len(val) == 0 {
		k.value = defaultVal
		return defaultVal
	}
	return val
}
644768
func (p *point) AppendString(buf []byte) []byte {
	buf = append(buf, p.key...)
	buf = append(buf, ' ')
	buf = append(buf, p.fields...)

	if !p.time.IsZero() {
		buf = append(buf, ' ')
		buf = strconv.AppendInt(buf, p.UnixNano(), 10)
	}

	return buf
}
611535
func (kvp KeyValuePair) String() string {
	var comment string
	if kvp.comment != nil {
		comment = kvp.comment.String()
	}
	if kvp.value == nil {
		return fmt.Sprintf("%s%s%s", kvp.key, kvp.ws, comment)
	}
	return fmt.Sprintf("%s=%s%s%s", kvp.key, kvp.ws, *kvp.value, comment)
}
412785
func NewKeyring() *Keyring {
	return &Keyring{
		encKeys: make(map[PublicKey]SecretKey),
		sigKeys: make(map[SigningPublicKey]SigningSecretKey),
	}
}
1094322
func (s *Section) KeyStrings() []string {
	list := make([]string, len(s.keyList))
	copy(list, s.keyList)
	return list
}
1252937
func (t *Taint) ToString() string {
	if len(t.Value) == 0 {
		return fmt.Sprintf("%v:%v", t.Key, t.Effect)
	}
	return fmt.Sprintf("%v=%v:%v", t.Key, t.Value, t.Effect)
}
1199716
func (r *Role) AddKeys(ids []string) {
	r.KeyIDs = mergeStrSlices(r.KeyIDs, ids)
}