summaryrefslogtreecommitdiffhomepage
path: root/docs/csview_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-08-12 21:54:53 +0200
committerTyge Løvset <[email protected]>2022-08-12 21:54:53 +0200
commitccb63f1abbae18657708dd8ea38e0892aa0fc48a (patch)
treef64f432f79ce1552951e2a88d80824af964878b6 /docs/csview_api.md
parent5f8a7951996728f6e91ef9ae2e904ce51ac0c883 (diff)
downloadSTC-modified-ccb63f1abbae18657708dd8ea38e0892aa0fc48a.tar.gz
STC-modified-ccb63f1abbae18657708dd8ea38e0892aa0fc48a.zip
cstr V4: Changed cstr functions to take pointers to self, not values. This is consistent with the rest of the containers. csview will still use values, as it is designed to be passed by value.
Diffstat (limited to 'docs/csview_api.md')
-rw-r--r--docs/csview_api.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/csview_api.md b/docs/csview_api.md
index 1e2ed408..79d108a3 100644
--- a/docs/csview_api.md
+++ b/docs/csview_api.md
@@ -92,11 +92,11 @@ uint64_t csview_hash(const csview* x);
## Types
-| Type name | Type definition | Used to represent... |
-|:----------------|:------------------------------------------|:-------------------------|
-| `csview` | `struct { const char *str; size_t size }` | The string view type |
-| `csview_value` | `char` | The string element type |
-| `csview_iter` | `struct { csview_value *ref; }` | UTF8 iterator |
+| Type name | Type definition | Used to represent... |
+|:----------------|:-------------------------------------------|:-------------------------|
+| `csview` | `struct { const char *str; size_t size; }` | The string view type |
+| `csview_value` | `char` | The string element type |
+| `csview_iter` | `struct { csview_value *ref; }` | UTF8 iterator |
## Constants and macros
@@ -118,7 +118,7 @@ int main ()
// (quoting Alfred N. Whitehead)
csview sv1 = cstr_substr(&str1, 3, 5); // "think"
- size_t pos = cstr_find(str1, "live"); // position of "live" in str1
+ size_t pos = cstr_find(&str1, "live"); // position of "live" in str1
csview sv2 = cstr_substr(&str1, pos, 4); // get "live"
csview sv3 = cstr_slice(&str1, -8, -1); // get "details"
printf("%" c_PRIsv "%" c_PRIsv "%" c_PRIsv "\n",