diff options
| author | Tyge Løvset <[email protected]> | 2021-12-30 16:14:57 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-12-30 16:14:57 +0100 |
| commit | a2ba1b88606659704625aa73397f80df2a0a038b (patch) | |
| tree | 3c11591dabc6b3ff34f3a06176da38e067ce5562 | |
| parent | eb0d095d7cdf5c5018d37be4319c99e2fdbfa9c5 (diff) | |
| download | STC-modified-a2ba1b88606659704625aa73397f80df2a0a038b.tar.gz STC-modified-a2ba1b88606659704625aa73397f80df2a0a038b.zip | |
Renamed c_default_clone to c_default_from (mostly used internally).
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | docs/cbox_api.md | 2 | ||||
| -rw-r--r-- | docs/ccommon_api.md | 4 | ||||
| -rw-r--r-- | examples/complex.c | 2 | ||||
| -rw-r--r-- | examples/queue.c | 2 | ||||
| -rw-r--r-- | examples/sview_split.c | 2 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 3 | ||||
| -rw-r--r-- | include/stc/template.h | 8 |
8 files changed, 12 insertions, 13 deletions
@@ -21,7 +21,7 @@ lasting deprecations, so you may develop production code using it. - Renamed: ***i_key_csptr*** / ***i_val_csptr*** to `i_key_sptr` / `i_val_sptr` for specifying **carc** and **cbox** values in containers. - Renamed: *csptr_X_make()* to `carc_X_from()`. - Renamed: *cstr_lit()* to `cstr_new(literal)`, and *cstr_assign_fmt()* to `cstr_printf()`. -- Renamed: *c_default_fromraw()* to `c_default_clone()`. +- Renamed: *c_default_fromraw()* to `c_default_from()`. - Changed: the [**c_apply**](docs/ccommon_api.md) macros API. - Replaced: *csview_first_token()* and *csview_next_token()* with one function: `csview_token()`. - Added: **checkauto** tool for checking that c-source files uses `c_auto*` macros correctly. diff --git a/docs/cbox_api.md b/docs/cbox_api.md index e05e69f0..3cc40aa0 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -81,7 +81,7 @@ void int_drop(int* x) { #define i_val int #define i_drop int_drop // optional func, just to display elements destroyed -#define i_from c_default_clone +#define i_from c_default_from #include <stc/cbox.h> // cbox_int #define i_key_sptr cbox_int // note: use i_key_sptr instead of i_key diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md index 3f21d3c0..10404a32 100644 --- a/docs/ccommon_api.md +++ b/docs/ccommon_api.md @@ -171,9 +171,9 @@ c_drop(cstr, &a, &b); ### General predefined template parameter functions ``` int c_default_cmp(const Type*, const Type*); -Type c_default_clone(Type val); // simple copy +Type c_default_from(Type val); // simple copy Type c_default_toraw(const Type* val); // dereference val -void c_default_drop(Type* val); // does nothing +void c_default_drop(Type* val); // does nothing int c_rawstr_cmp(const char* const* a, const char* const* b); bool c_rawstr_eq(const char* const* a, const char* const* b); diff --git a/examples/complex.c b/examples/complex.c index 17a10fad..747cec07 100644 --- a/examples/complex.c +++ b/examples/complex.c @@ -5,7 +5,7 @@ void check_drop(float* v) {printf("destroy %g\n", *v);} #define i_type FloatStack
#define i_val float
#define i_drop check_drop
-#define i_from c_default_clone
+#define i_from c_default_from
#include <stc/cstack.h>
#define i_type StackList
diff --git a/examples/queue.c b/examples/queue.c index ffd0a1e7..2ea82080 100644 --- a/examples/queue.c +++ b/examples/queue.c @@ -3,7 +3,7 @@ #define i_val int
#define i_drop(x) printf("drop %d\n", *(x))
-#define i_from c_default_clone
+#define i_from c_default_from
#define i_tag i
#include <stc/cqueue.h>
diff --git a/examples/sview_split.c b/examples/sview_split.c index bd5c26d5..8e8443b8 100644 --- a/examples/sview_split.c +++ b/examples/sview_split.c @@ -1,5 +1,5 @@ #include <stc/csview.h>
-#define c_arg(a) a
+
int main()
{
// No memory allocations or string length calculations!
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index ce5346e2..3bdc35c4 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -103,8 +103,7 @@ typedef const char c_strlit[]; #define c_default_eq(x, y) (*(x) == *(y))
#define c_memcmp_eq(x, y) (memcmp(x, y, sizeof *(x)) == 0)
-#define c_default_clone(x) (x)
-#define c_default_fromraw(x) (x) // [deprecated]
+#define c_default_from(x) (x)
#define c_default_toraw(ptr) (*(ptr))
#define c_default_drop(ptr) ((void) (ptr))
diff --git a/include/stc/template.h b/include/stc/template.h index 7d5c70b9..77748fc1 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -159,10 +159,10 @@ #define i_tag i_key
#endif
#if !defined _i_has_internal_clone && defined i_keydrop && !defined i_keyfrom && !c_option(c_no_clone)
- #error "i_keydrop defined but not i_keyfrom (e.g. as c_default_clone), or no 'i_opt c_no_clone'"
+ #error "i_keydrop defined but not i_keyfrom (e.g. as c_default_from), or no 'i_opt c_no_clone'"
#endif
#if !defined i_keyfrom
- #define i_keyfrom c_default_clone
+ #define i_keyfrom c_default_from
#endif
#ifndef i_keyraw
#define _i_no_keyraw
@@ -185,10 +185,10 @@ #define i_tag i_val
#endif
#if !defined _i_has_internal_clone && defined i_valdrop && !defined i_valfrom && !c_option(c_no_clone)
- #error "i_valdrop/i_drop defined but not i_valfrom (e.g. as c_default_clone), or no 'i_opt c_no_clone'"
+ #error "i_valdrop/i_drop defined but not i_valfrom (e.g. as c_default_from), or no 'i_opt c_no_clone'"
#endif
#if !defined i_valfrom
- #define i_valfrom c_default_clone
+ #define i_valfrom c_default_from
#endif
#ifndef i_valraw
#if !defined i_key || defined _i_no_keyraw
|
