aboutsummaryrefslogtreecommitdiff
path: root/src/base/string/len.c
blob: cd0c36068579c84211b9baae443af677be53d9a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "internal.h"

// len returns the length of the string.
int
string·len(string s)
{
    Hdr* h = (Hdr*)(s - sizeof(Hdr));
    return h->len;
}

// cap returns the capacity of the string buffer.
int
string·cap(string s)
{
    Hdr* h = (Hdr*)(s - sizeof(Hdr));
    return h->cap;
}