summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/csptr_api.md8
-rw-r--r--include/stc/csptr.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/docs/csptr_api.md b/docs/csptr_api.md
index 6080f714..beafa5b9 100644
--- a/docs/csptr_api.md
+++ b/docs/csptr_api.md
@@ -36,17 +36,17 @@ Use *csptr_X_clone(p)* when sharing ownership of the pointed-to object. See exam
The *csptr_X_compare()*, *csptr_X_equals()* and *csptr_X_del()* methods are defined based on the *valeCompare* and *valueDel* arguments passed to the **using**-macro.
```c
-csptr_X csptr_X_from(Value* p); // constructor
-csptr_X csptr_X_make(Value val); // make_shared
+csptr_X csptr_X_from(Value* p); // constructor
+csptr_X csptr_X_make(Value val); // make_shared; fast
void csptr_X_reset(csptr_X* self);
-csptr_X_value_t* csptr_X_reset_from(csptr_X* self, Value* p);
+csptr_X_value_t* csptr_X_reset_from(csptr_X* self, Value* p); // slower than reset_make().
csptr_X_value_t* csptr_X_reset_make(csptr_X* self, Value val); // assign new sptr with value
csptr_X_value_t* csptr_X_copy(csptr_X* self, CX other); // copy shared (increase use count)
csptr_X csptr_X_clone(csptr_X ptr); // clone shared (increase use count)
-void csptr_X_move(csptr_X* self); // transfer ownership instead of sharing.
+csptr_X csptr_X_move(csptr_X* self); // fast transfer ownership to another sptr.
void csptr_X_del(csptr_X* self); // destruct: decrease use count, free at 0
int csptr_X_compare(const csptr_X* x, const csptr_X* y);
diff --git a/include/stc/csptr.h b/include/stc/csptr.h
index 60b9997f..4637963e 100644
--- a/include/stc/csptr.h
+++ b/include/stc/csptr.h
@@ -25,7 +25,7 @@
#include "ccommon.h"
-/* csptr: std::shared_ptr -like type:
+/* csptr: shared_ptr type
#include <stc/csptr.h>
#include <stc/cstr.h>
@@ -36,7 +36,7 @@ Person Person_init(const char* name, const char* last) {
return (Person){.name = cstr_from(name), .last = cstr_from(last)};
}
void Person_del(Person* p) {
- printf("del: %s\n", p->name.str);
+ printf("del: %s %s\n", p->name.str, p->last.str);
c_del(cstr, &p->name, &p->last);
}