summaryrefslogtreecommitdiff
path: root/core/pkg
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-13 22:05:42 +0800
committerruki <[email protected]>2015-05-13 22:05:42 +0800
commit74ece0defa314bab78262d95bee517bdc09df689 (patch)
tree950684880d0193e60956a9b695cab50861208ff4 /core/pkg
parent1f45e3bf9b41a413804305fc23810639b977a9f1 (diff)
add preprocessor and update tbox
Diffstat (limited to 'core/pkg')
-rw-r--r--core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h2
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/memory/buffer.h90
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h40
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h44
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/network/cookies.h4
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/object/data.h4
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/object/string.h2
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/string/static_string.h75
-rwxr-xr-xcore/pkg/tbox.pkg/inc/tbox/string/string.h79
9 files changed, 173 insertions, 167 deletions
diff --git a/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h b/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h
index d05f235cd..22f02c45d 100644
--- a/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h
+++ b/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h
@@ -14,7 +14,7 @@
#define TB_CONFIG_VERSION_ALTER 8
// build version
-#define TB_CONFIG_VERSION_BUILD 201505041915
+#define TB_CONFIG_VERSION_BUILD 201505132122
// small
#define TB_CONFIG_SMALL (0)
diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h b/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h
index 0d0cee6c2..98c6f568e 100755
--- a/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h
+++ b/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h
@@ -57,203 +57,203 @@ typedef struct __tb_buffer_t
tb_byte_t buff[64];
#endif
-}tb_buffer_t;
+}tb_buffer_t, *tb_buffer_ref_t;
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
*/
-/*! init the scoped buffer
+/*! init the buffer
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
*
* @return tb_true or tb_false
*/
-tb_bool_t tb_buffer_init(tb_buffer_t* buffer);
+tb_bool_t tb_buffer_init(tb_buffer_ref_t buffer);
-/*! exit the scoped buffer
+/*! exit the buffer
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
*/
-tb_void_t tb_buffer_exit(tb_buffer_t* buffer);
+tb_void_t tb_buffer_exit(tb_buffer_ref_t buffer);
/*! the buffer data
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_data(tb_buffer_t* buffer);
+tb_byte_t* tb_buffer_data(tb_buffer_ref_t buffer);
/*! the buffer data size
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
*
* @return the buffer data size
*/
-tb_size_t tb_buffer_size(tb_buffer_t const* buffer);
+tb_size_t tb_buffer_size(tb_buffer_ref_t buffer);
/*! the buffer data maxn
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
*
* @return the buffer data maxn
*/
-tb_size_t tb_buffer_maxn(tb_buffer_t const* buffer);
+tb_size_t tb_buffer_maxn(tb_buffer_ref_t buffer);
/*! clear the buffer
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
*/
-tb_void_t tb_buffer_clear(tb_buffer_t* buffer);
+tb_void_t tb_buffer_clear(tb_buffer_ref_t buffer);
/*! resize the buffer size
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param size the new buffer size
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_resize(tb_buffer_t* buffer, tb_size_t size);
+tb_byte_t* tb_buffer_resize(tb_buffer_ref_t buffer, tb_size_t size);
/*! memset: b => 0 ... e
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the filled byte
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memset(tb_buffer_t* buffer, tb_byte_t b);
+tb_byte_t* tb_buffer_memset(tb_buffer_ref_t buffer, tb_byte_t b);
/*! memset: b => p ... e
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param p the start position
* @param b the filled byte
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memsetp(tb_buffer_t* buffer, tb_size_t p, tb_byte_t b);
+tb_byte_t* tb_buffer_memsetp(tb_buffer_ref_t buffer, tb_size_t p, tb_byte_t b);
/*! memset: b => 0 ... n
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the filled byte
* @param n the filled count
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memnset(tb_buffer_t* buffer, tb_byte_t b, tb_size_t n);
+tb_byte_t* tb_buffer_memnset(tb_buffer_ref_t buffer, tb_byte_t b, tb_size_t n);
/*! memset: b => p ... n
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param p the start position
* @param b the filled byte
* @param n the filled count
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memnsetp(tb_buffer_t* buffer, tb_size_t p, tb_byte_t b, tb_size_t n);
+tb_byte_t* tb_buffer_memnsetp(tb_buffer_ref_t buffer, tb_size_t p, tb_byte_t b, tb_size_t n);
/*! memcpy: b => 0 ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the copied buffer
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memcpy(tb_buffer_t* buffer, tb_buffer_t* b);
+tb_byte_t* tb_buffer_memcpy(tb_buffer_ref_t buffer, tb_buffer_ref_t b);
/*! memcpy: b => p ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param p the start position
* @param b the copied buffer
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memcpyp(tb_buffer_t* buffer, tb_size_t p, tb_buffer_t* b);
+tb_byte_t* tb_buffer_memcpyp(tb_buffer_ref_t buffer, tb_size_t p, tb_buffer_ref_t b);
/*! memcpy: b ... n => 0 ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the copied buffer
* @param n the copied count
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memncpy(tb_buffer_t* buffer, tb_byte_t const* b, tb_size_t n);
+tb_byte_t* tb_buffer_memncpy(tb_buffer_ref_t buffer, tb_byte_t const* b, tb_size_t n);
/*! memcpy: b ... n => p ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param p the start position
* @param b the copied buffer
* @param n the copied count
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memncpyp(tb_buffer_t* buffer, tb_size_t p, tb_byte_t const* b, tb_size_t n);
+tb_byte_t* tb_buffer_memncpyp(tb_buffer_ref_t buffer, tb_size_t p, tb_byte_t const* b, tb_size_t n);
/*! memmov: b ... e => 0 ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the moved start position
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memmov(tb_buffer_t* buffer, tb_size_t b);
+tb_byte_t* tb_buffer_memmov(tb_buffer_ref_t buffer, tb_size_t b);
/*! memmov: b ... e => p ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param p the moved destination position
* @param b the moved start position
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memmovp(tb_buffer_t* buffer, tb_size_t p, tb_size_t b);
+tb_byte_t* tb_buffer_memmovp(tb_buffer_ref_t buffer, tb_size_t p, tb_size_t b);
/*! memmov: b ... n => 0 ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the moved start position
* @param n the moved count
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memnmov(tb_buffer_t* buffer, tb_size_t b, tb_size_t n);
+tb_byte_t* tb_buffer_memnmov(tb_buffer_ref_t buffer, tb_size_t b, tb_size_t n);
/*! memmov: b ... n => p ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param p the moved destination position
* @param b the moved start position
* @param n the moved count
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memnmovp(tb_buffer_t* buffer, tb_size_t p, tb_size_t b, tb_size_t n);
+tb_byte_t* tb_buffer_memnmovp(tb_buffer_ref_t buffer, tb_size_t p, tb_size_t b, tb_size_t n);
/*! memcat: b +=> e ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the concated buffer
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memcat(tb_buffer_t* buffer, tb_buffer_t* b);
+tb_byte_t* tb_buffer_memcat(tb_buffer_ref_t buffer, tb_buffer_ref_t b);
/*! memcat: b ... n +=> e ...
*
- * @param buffer the scoped buffer
+ * @param buffer the buffer
* @param b the concated buffer
* @param n the concated count
*
* @return the buffer data address
*/
-tb_byte_t* tb_buffer_memncat(tb_buffer_t* buffer, tb_byte_t const* b, tb_size_t n);
+tb_byte_t* tb_buffer_memncat(tb_buffer_ref_t buffer, tb_byte_t const* b, tb_size_t n);
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h b/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h
index 8ba797f4f..cb4c18d4f 100755
--- a/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h
+++ b/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h
@@ -53,7 +53,7 @@ typedef struct __tb_queue_buffer_t
// the buffer maxn
tb_size_t maxn;
-}tb_queue_buffer_t;
+}tb_queue_buffer_t, *tb_queue_buffer_ref_t;
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
@@ -66,13 +66,13 @@ typedef struct __tb_queue_buffer_t
*
* @return tb_true or tb_false
*/
-tb_bool_t tb_queue_buffer_init(tb_queue_buffer_t* buffer, tb_size_t maxn);
+tb_bool_t tb_queue_buffer_init(tb_queue_buffer_ref_t buffer, tb_size_t maxn);
/*! exit buffer
*
* @param buffer the buffer
*/
-tb_void_t tb_queue_buffer_exit(tb_queue_buffer_t* buffer);
+tb_void_t tb_queue_buffer_exit(tb_queue_buffer_ref_t buffer);
/*! the buffer data
*
@@ -80,7 +80,7 @@ tb_void_t tb_queue_buffer_exit(tb_queue_buffer_t* buffer);
*
* @return the buffer data
*/
-tb_byte_t* tb_queue_buffer_data(tb_queue_buffer_t const* buffer);
+tb_byte_t* tb_queue_buffer_data(tb_queue_buffer_ref_t buffer);
/*! the buffer head
*
@@ -88,7 +88,7 @@ tb_byte_t* tb_queue_buffer_data(tb_queue_buffer_t const* buffer);
*
* @return the buffer head
*/
-tb_byte_t* tb_queue_buffer_head(tb_queue_buffer_t const* buffer);
+tb_byte_t* tb_queue_buffer_head(tb_queue_buffer_ref_t buffer);
/*! the buffer tail
*
@@ -96,7 +96,7 @@ tb_byte_t* tb_queue_buffer_head(tb_queue_buffer_t const* buffer);
*
* @return the buffer tail
*/
-tb_byte_t* tb_queue_buffer_tail(tb_queue_buffer_t const* buffer);
+tb_byte_t* tb_queue_buffer_tail(tb_queue_buffer_ref_t buffer);
/*! the buffer maxn
*
@@ -104,7 +104,7 @@ tb_byte_t* tb_queue_buffer_tail(tb_queue_buffer_t const* buffer);
*
* @return the buffer maxn
*/
-tb_size_t tb_queue_buffer_maxn(tb_queue_buffer_t const* buffer);
+tb_size_t tb_queue_buffer_maxn(tb_queue_buffer_ref_t buffer);
/*! the buffer size
*
@@ -112,7 +112,7 @@ tb_size_t tb_queue_buffer_maxn(tb_queue_buffer_t const* buffer);
*
* @return the buffer size
*/
-tb_size_t tb_queue_buffer_size(tb_queue_buffer_t const* buffer);
+tb_size_t tb_queue_buffer_size(tb_queue_buffer_ref_t buffer);
/*! the buffer left
*
@@ -120,7 +120,7 @@ tb_size_t tb_queue_buffer_size(tb_queue_buffer_t const* buffer);
*
* @return the buffer left
*/
-tb_size_t tb_queue_buffer_left(tb_queue_buffer_t const* buffer);
+tb_size_t tb_queue_buffer_left(tb_queue_buffer_ref_t buffer);
/*! the buffer full?
*
@@ -128,7 +128,7 @@ tb_size_t tb_queue_buffer_left(tb_queue_buffer_t const* buffer);
*
* @return tb_true or tb_false
*/
-tb_bool_t tb_queue_buffer_full(tb_queue_buffer_t const* buffer);
+tb_bool_t tb_queue_buffer_full(tb_queue_buffer_ref_t buffer);
/*! the buffer null?
*
@@ -136,13 +136,13 @@ tb_bool_t tb_queue_buffer_full(tb_queue_buffer_t const* buffer);
*
* @return tb_true or tb_false
*/
-tb_bool_t tb_queue_buffer_null(tb_queue_buffer_t const* buffer);
+tb_bool_t tb_queue_buffer_null(tb_queue_buffer_ref_t buffer);
/*! clear buffer
*
* @param buffer the buffer
*/
-tb_void_t tb_queue_buffer_clear(tb_queue_buffer_t* buffer);
+tb_void_t tb_queue_buffer_clear(tb_queue_buffer_ref_t buffer);
/*! resize buffer size
*
@@ -151,7 +151,7 @@ tb_void_t tb_queue_buffer_clear(tb_queue_buffer_t* buffer);
*
* @return the buffer data
*/
-tb_byte_t* tb_queue_buffer_resize(tb_queue_buffer_t* buffer, tb_size_t maxn);
+tb_byte_t* tb_queue_buffer_resize(tb_queue_buffer_ref_t buffer, tb_size_t maxn);
/*! skip buffer
*
@@ -160,7 +160,7 @@ tb_byte_t* tb_queue_buffer_resize(tb_queue_buffer_t* buffer, tb_size_t
*
* @return the real size
*/
-tb_long_t tb_queue_buffer_skip(tb_queue_buffer_t* buffer, tb_size_t size);
+tb_long_t tb_queue_buffer_skip(tb_queue_buffer_ref_t buffer, tb_size_t size);
/*! read buffer
*
@@ -170,7 +170,7 @@ tb_long_t tb_queue_buffer_skip(tb_queue_buffer_t* buffer, tb_size_t si
*
* @return the real size
*/
-tb_long_t tb_queue_buffer_read(tb_queue_buffer_t* buffer, tb_byte_t* data, tb_size_t size);
+tb_long_t tb_queue_buffer_read(tb_queue_buffer_ref_t buffer, tb_byte_t* data, tb_size_t size);
/*! writ buffer
*
@@ -180,7 +180,7 @@ tb_long_t tb_queue_buffer_read(tb_queue_buffer_t* buffer, tb_byte_t* d
*
* @return the real size
*/
-tb_long_t tb_queue_buffer_writ(tb_queue_buffer_t* buffer, tb_byte_t const* data, tb_size_t size);
+tb_long_t tb_queue_buffer_writ(tb_queue_buffer_ref_t buffer, tb_byte_t const* data, tb_size_t size);
/*! init pull buffer for reading
*
@@ -189,14 +189,14 @@ tb_long_t tb_queue_buffer_writ(tb_queue_buffer_t* buffer, tb_byte_t co
*
* @return the data
*/
-tb_byte_t* tb_queue_buffer_pull_init(tb_queue_buffer_t* buffer, tb_size_t* size);
+tb_byte_t* tb_queue_buffer_pull_init(tb_queue_buffer_ref_t buffer, tb_size_t* size);
/*! exit pull buffer for reading
*
* @param buffer the buffer
* @param size the size
*/
-tb_void_t tb_queue_buffer_pull_exit(tb_queue_buffer_t* buffer, tb_size_t size);
+tb_void_t tb_queue_buffer_pull_exit(tb_queue_buffer_ref_t buffer, tb_size_t size);
/*! init push buffer for writing
*
@@ -205,14 +205,14 @@ tb_void_t tb_queue_buffer_pull_exit(tb_queue_buffer_t* buffer, tb_size
*
* @return the data
*/
-tb_byte_t* tb_queue_buffer_push_init(tb_queue_buffer_t* buffer, tb_size_t* size);
+tb_byte_t* tb_queue_buffer_push_init(tb_queue_buffer_ref_t buffer, tb_size_t* size);
/*! exit push buffer for writing
*
* @param buffer the buffer
* @param size the size
*/
-tb_void_t tb_queue_buffer_push_exit(tb_queue_buffer_t* buffer, tb_size_t size);
+tb_void_t tb_queue_buffer_push_exit(tb_queue_buffer_ref_t buffer, tb_size_t size);
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h b/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h
index 95d307551..daaa065fd 100755
--- a/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h
+++ b/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h
@@ -50,7 +50,7 @@ typedef struct __tb_static_buffer_t
// the buffer maxn
tb_size_t maxn;
-}tb_static_buffer_t;
+}tb_static_buffer_t, *tb_static_buffer_ref_t;
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
@@ -64,13 +64,13 @@ typedef struct __tb_static_buffer_t
*
* @return tb_true or tb_false
*/
-tb_bool_t tb_static_buffer_init(tb_static_buffer_t* buffer, tb_byte_t* data, tb_size_t maxn);
+tb_bool_t tb_static_buffer_init(tb_static_buffer_ref_t buffer, tb_byte_t* data, tb_size_t maxn);
/*! exit the static buffer
*
* @param buffer the static buffer
*/
-tb_void_t tb_static_buffer_exit(tb_static_buffer_t* buffer);
+tb_void_t tb_static_buffer_exit(tb_static_buffer_ref_t buffer);
/*! the buffer data
*
@@ -78,7 +78,7 @@ tb_void_t tb_static_buffer_exit(tb_static_buffer_t* buffer);
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_data(tb_static_buffer_t* buffer);
+tb_byte_t* tb_static_buffer_data(tb_static_buffer_ref_t buffer);
/*! the buffer data size
*
@@ -86,7 +86,7 @@ tb_byte_t* tb_static_buffer_data(tb_static_buffer_t* buffer);
*
* @return the buffer data size
*/
-tb_size_t tb_static_buffer_size(tb_static_buffer_t const* buffer);
+tb_size_t tb_static_buffer_size(tb_static_buffer_ref_t buffer);
/*! the buffer data maxn
*
@@ -94,13 +94,13 @@ tb_size_t tb_static_buffer_size(tb_static_buffer_t const* buffer);
*
* @return the buffer data maxn
*/
-tb_size_t tb_static_buffer_maxn(tb_static_buffer_t const* buffer);
+tb_size_t tb_static_buffer_maxn(tb_static_buffer_ref_t buffer);
/*! clear the buffer
*
* @param buffer the static buffer
*/
-tb_void_t tb_static_buffer_clear(tb_static_buffer_t* buffer);
+tb_void_t tb_static_buffer_clear(tb_static_buffer_ref_t buffer);
/*! resize the buffer size
*
@@ -109,7 +109,7 @@ tb_void_t tb_static_buffer_clear(tb_static_buffer_t* buffer);
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_resize(tb_static_buffer_t* buffer, tb_size_t size);
+tb_byte_t* tb_static_buffer_resize(tb_static_buffer_ref_t buffer, tb_size_t size);
/*! memset: b => 0 ... e
*
@@ -118,7 +118,7 @@ tb_byte_t* tb_static_buffer_resize(tb_static_buffer_t* buffer, tb_size_
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memset(tb_static_buffer_t* buffer, tb_byte_t b);
+tb_byte_t* tb_static_buffer_memset(tb_static_buffer_ref_t buffer, tb_byte_t b);
/*! memset: b => p ... e
*
@@ -128,7 +128,7 @@ tb_byte_t* tb_static_buffer_memset(tb_static_buffer_t* buffer, tb_byte_
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memsetp(tb_static_buffer_t* buffer, tb_size_t p, tb_byte_t b);
+tb_byte_t* tb_static_buffer_memsetp(tb_static_buffer_ref_t buffer, tb_size_t p, tb_byte_t b);
/*! memset: b => 0 ... n
*
@@ -138,7 +138,7 @@ tb_byte_t* tb_static_buffer_memsetp(tb_static_buffer_t* buffer, tb_size
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memnset(tb_static_buffer_t* buffer, tb_byte_t b, tb_size_t n);
+tb_byte_t* tb_static_buffer_memnset(tb_static_buffer_ref_t buffer, tb_byte_t b, tb_size_t n);
/*! memset: b => p ... n
*
@@ -149,7 +149,7 @@ tb_byte_t* tb_static_buffer_memnset(tb_static_buffer_t* buffer, tb_byte
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memnsetp(tb_static_buffer_t* buffer, tb_size_t p, tb_byte_t b, tb_size_t n);
+tb_byte_t* tb_static_buffer_memnsetp(tb_static_buffer_ref_t buffer, tb_size_t p, tb_byte_t b, tb_size_t n);
/*! memcpy: b => 0 ...
*
@@ -158,7 +158,7 @@ tb_byte_t* tb_static_buffer_memnsetp(tb_static_buffer_t* buffer, tb_siz
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memcpy(tb_static_buffer_t* buffer, tb_static_buffer_t* b);
+tb_byte_t* tb_static_buffer_memcpy(tb_static_buffer_ref_t buffer, tb_static_buffer_ref_t b);
/*! memcpy: b => p ...
*
@@ -168,7 +168,7 @@ tb_byte_t* tb_static_buffer_memcpy(tb_static_buffer_t* buffer, tb_stati
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memcpyp(tb_static_buffer_t* buffer, tb_size_t p, tb_static_buffer_t* b);
+tb_byte_t* tb_static_buffer_memcpyp(tb_static_buffer_ref_t buffer, tb_size_t p, tb_static_buffer_ref_t b);
/*! memcpy: b ... n => 0 ...
*
@@ -178,7 +178,7 @@ tb_byte_t* tb_static_buffer_memcpyp(tb_static_buffer_t* buffer, tb_size
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memncpy(tb_static_buffer_t* buffer, tb_byte_t const* b, tb_size_t n);
+tb_byte_t* tb_static_buffer_memncpy(tb_static_buffer_ref_t buffer, tb_byte_t const* b, tb_size_t n);
/*! memcpy: b ... n => p ...
*
@@ -189,7 +189,7 @@ tb_byte_t* tb_static_buffer_memncpy(tb_static_buffer_t* buffer, tb_byte
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memncpyp(tb_static_buffer_t* buffer, tb_size_t p, tb_byte_t const* b, tb_size_t n);
+tb_byte_t* tb_static_buffer_memncpyp(tb_static_buffer_ref_t buffer, tb_size_t p, tb_byte_t const* b, tb_size_t n);
/*! memmov: b ... e => 0 ...
*
@@ -198,7 +198,7 @@ tb_byte_t* tb_static_buffer_memncpyp(tb_static_buffer_t* buffer, tb_siz
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memmov(tb_static_buffer_t* buffer, tb_size_t b);
+tb_byte_t* tb_static_buffer_memmov(tb_static_buffer_ref_t buffer, tb_size_t b);
/*! memmov: b ... e => p ...
*
@@ -208,7 +208,7 @@ tb_byte_t* tb_static_buffer_memmov(tb_static_buffer_t* buffer, tb_size_
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memmovp(tb_static_buffer_t* buffer, tb_size_t p, tb_size_t b);
+tb_byte_t* tb_static_buffer_memmovp(tb_static_buffer_ref_t buffer, tb_size_t p, tb_size_t b);
/*! memmov: b ... n => 0 ...
*
@@ -218,7 +218,7 @@ tb_byte_t* tb_static_buffer_memmovp(tb_static_buffer_t* buffer, tb_size
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memnmov(tb_static_buffer_t* buffer, tb_size_t b, tb_size_t n);
+tb_byte_t* tb_static_buffer_memnmov(tb_static_buffer_ref_t buffer, tb_size_t b, tb_size_t n);
/*! memmov: b ... n => p ...
*
@@ -229,7 +229,7 @@ tb_byte_t* tb_static_buffer_memnmov(tb_static_buffer_t* buffer, tb_size
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memnmovp(tb_static_buffer_t* buffer, tb_size_t p, tb_size_t b, tb_size_t n);
+tb_byte_t* tb_static_buffer_memnmovp(tb_static_buffer_ref_t buffer, tb_size_t p, tb_size_t b, tb_size_t n);
/*! memcat: b +=> e ...
*
@@ -238,7 +238,7 @@ tb_byte_t* tb_static_buffer_memnmovp(tb_static_buffer_t* buffer, tb_siz
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memcat(tb_static_buffer_t* buffer, tb_static_buffer_t* b);
+tb_byte_t* tb_static_buffer_memcat(tb_static_buffer_ref_t buffer, tb_static_buffer_ref_t b);
/*! memcat: b ... n +=> e ...
*
@@ -248,7 +248,7 @@ tb_byte_t* tb_static_buffer_memcat(tb_static_buffer_t* buffer, tb_stati
*
* @return the buffer data address
*/
-tb_byte_t* tb_static_buffer_memncat(tb_static_buffer_t* buffer, tb_byte_t const* b, tb_size_t n);
+tb_byte_t* tb_static_buffer_memncat(tb_static_buffer_ref_t buffer, tb_byte_t const* b, tb_size_t n);
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
diff --git a/core/pkg/tbox.pkg/inc/tbox/network/cookies.h b/core/pkg/tbox.pkg/inc/tbox/network/cookies.h
index 9178513f9..5d6438fe9 100755
--- a/core/pkg/tbox.pkg/inc/tbox/network/cookies.h
+++ b/core/pkg/tbox.pkg/inc/tbox/network/cookies.h
@@ -262,7 +262,7 @@ tb_bool_t tb_cookies_set_from_url(tb_cookies_ref_t cookies, tb_char_t
*
* @return the cookies data
*/
-tb_char_t const* tb_cookies_get(tb_cookies_ref_t cookies, tb_char_t const* domain, tb_char_t const* path, tb_bool_t secure, tb_string_t* value);
+tb_char_t const* tb_cookies_get(tb_cookies_ref_t cookies, tb_char_t const* domain, tb_char_t const* path, tb_bool_t secure, tb_string_ref_t value);
/*! get cookies from the given url
*
@@ -272,7 +272,7 @@ tb_char_t const* tb_cookies_get(tb_cookies_ref_t cookies, tb_char_t const* do
*
* @return the cookies data
*/
-tb_char_t const* tb_cookies_get_from_url(tb_cookies_ref_t cookies, tb_char_t const* url, tb_string_t* value);
+tb_char_t const* tb_cookies_get_from_url(tb_cookies_ref_t cookies, tb_char_t const* url, tb_string_ref_t value);
/*! clear cookies
*
diff --git a/core/pkg/tbox.pkg/inc/tbox/object/data.h b/core/pkg/tbox.pkg/inc/tbox/object/data.h
index 7cd8f870c..893f1568b 100755
--- a/core/pkg/tbox.pkg/inc/tbox/object/data.h
+++ b/core/pkg/tbox.pkg/inc/tbox/object/data.h
@@ -62,7 +62,7 @@ tb_object_ref_t tb_object_data_init_from_data(tb_pointer_t data, tb_size_t s
*
* @return the data object
*/
-tb_object_ref_t tb_object_data_init_from_buffer(tb_buffer_t* buffer);
+tb_object_ref_t tb_object_data_init_from_buffer(tb_buffer_ref_t buffer);
/*! get the data
*
@@ -96,7 +96,7 @@ tb_size_t tb_object_data_size(tb_object_ref_t data);
*
* @return the data buffer
*/
-tb_buffer_t* tb_object_data_buffer(tb_object_ref_t data);
+tb_buffer_ref_t tb_object_data_buffer(tb_object_ref_t data);
/*! writ data to url
*
diff --git a/core/pkg/tbox.pkg/inc/tbox/object/string.h b/core/pkg/tbox.pkg/inc/tbox/object/string.h
index 915102ed0..a3721b777 100755
--- a/core/pkg/tbox.pkg/inc/tbox/object/string.h
+++ b/core/pkg/tbox.pkg/inc/tbox/object/string.h
@@ -52,7 +52,7 @@ tb_object_ref_t tb_object_string_init_from_cstr(tb_char_t const* cstr);
*
* @return the string object
*/
-tb_object_ref_t tb_object_string_init_from_str(tb_string_t* str);
+tb_object_ref_t tb_object_string_init_from_str(tb_string_ref_t str);
/*! the c-string
*
diff --git a/core/pkg/tbox.pkg/inc/tbox/string/static_string.h b/core/pkg/tbox.pkg/inc/tbox/string/static_string.h
index 8b76f37fd..4a8bcd0c9 100755
--- a/core/pkg/tbox.pkg/inc/tbox/string/static_string.h
+++ b/core/pkg/tbox.pkg/inc/tbox/string/static_string.h
@@ -40,7 +40,10 @@ __tb_extern_c_enter__
*/
/// the static string type
-typedef tb_static_buffer_t tb_static_string_t;
+typedef tb_static_buffer_t tb_static_string_t;
+
+/// the static string ref type
+typedef tb_static_buffer_ref_t tb_static_string_ref_t;
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
@@ -54,13 +57,13 @@ typedef tb_static_buffer_t tb_static_string_t;
*
* @return tb_true or tb_false
*/
-tb_bool_t tb_static_string_init(tb_static_string_t* string, tb_char_t* data, tb_size_t maxn);
+tb_bool_t tb_static_string_init(tb_static_string_ref_t string, tb_char_t* data, tb_size_t maxn);
/*! exit string
*
* @param string the string
*/
-tb_void_t tb_static_string_exit(tb_static_string_t* string);
+tb_void_t tb_static_string_exit(tb_static_string_ref_t string);
/*! the c-string pointer
*
@@ -68,7 +71,7 @@ tb_void_t tb_static_string_exit(tb_static_string_t* string);
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_cstr(tb_static_string_t const* string);
+tb_char_t const* tb_static_string_cstr(tb_static_string_ref_t string);
/*! the string size
*
@@ -76,13 +79,13 @@ tb_char_t const* tb_static_string_cstr(tb_static_string_t const* string);
*
* @return the string size
*/
-tb_size_t tb_static_string_size(tb_static_string_t const* string);
+tb_size_t tb_static_string_size(tb_static_string_ref_t string);
/*! clear the string
*
* @param string the string
*/
-tb_void_t tb_static_string_clear(tb_static_string_t* string);
+tb_void_t tb_static_string_clear(tb_static_string_ref_t string);
/*! strip the string
*
@@ -91,7 +94,7 @@ tb_void_t tb_static_string_clear(tb_static_string_t* string);
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_strip(tb_static_string_t* string, tb_size_t n);
+tb_char_t const* tb_static_string_strip(tb_static_string_ref_t string, tb_size_t n);
/*! trim the right spaces for string
*
@@ -99,7 +102,7 @@ tb_char_t const* tb_static_string_strip(tb_static_string_t* string, tb_si
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_rtrim(tb_static_string_t* string);
+tb_char_t const* tb_static_string_rtrim(tb_static_string_ref_t string);
/*! find charactor position
*
@@ -109,7 +112,7 @@ tb_char_t const* tb_static_string_rtrim(tb_static_string_t* string);
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_strchr(tb_static_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_static_string_strchr(tb_static_string_ref_t string, tb_size_t p, tb_char_t c);
/*! find charactor position and ignore case
*
@@ -119,7 +122,7 @@ tb_long_t tb_static_string_strchr(tb_static_string_t const* string
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_strichr(tb_static_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_static_string_strichr(tb_static_string_ref_t string, tb_size_t p, tb_char_t c);
/*! reverse to find charactor position
*
@@ -129,7 +132,7 @@ tb_long_t tb_static_string_strichr(tb_static_string_t const* strin
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_strrchr(tb_static_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_static_string_strrchr(tb_static_string_ref_t string, tb_size_t p, tb_char_t c);
/*! reverse to find charactor position and ignore case
*
@@ -139,7 +142,7 @@ tb_long_t tb_static_string_strrchr(tb_static_string_t const* strin
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_strirchr(tb_static_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_static_string_strirchr(tb_static_string_ref_t string, tb_size_t p, tb_char_t c);
/*! find string position
*
@@ -149,7 +152,7 @@ tb_long_t tb_static_string_strirchr(tb_static_string_t const* stri
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_strstr(tb_static_string_t const* string, tb_size_t p, tb_static_string_t const* s);
+tb_long_t tb_static_string_strstr(tb_static_string_ref_t string, tb_size_t p, tb_static_string_ref_t s);
/*! find string position and ignore case
*
@@ -159,7 +162,7 @@ tb_long_t tb_static_string_strstr(tb_static_string_t const* string
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_stristr(tb_static_string_t const* string, tb_size_t p, tb_static_string_t const* s);
+tb_long_t tb_static_string_stristr(tb_static_string_ref_t string, tb_size_t p, tb_static_string_ref_t s);
/*! find c-string position
*
@@ -169,7 +172,7 @@ tb_long_t tb_static_string_stristr(tb_static_string_t const* strin
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_cstrstr(tb_static_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_static_string_cstrstr(tb_static_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! find c-string position and ignore case
*
@@ -179,7 +182,7 @@ tb_long_t tb_static_string_cstrstr(tb_static_string_t const* strin
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_cstristr(tb_static_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_static_string_cstristr(tb_static_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! reverse to find string position
*
@@ -189,7 +192,7 @@ tb_long_t tb_static_string_cstristr(tb_static_string_t const* stri
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_strrstr(tb_static_string_t const* string, tb_size_t p, tb_static_string_t const* s);
+tb_long_t tb_static_string_strrstr(tb_static_string_ref_t string, tb_size_t p, tb_static_string_ref_t s);
/*! reverse to find string position and ignore case
*
@@ -199,7 +202,7 @@ tb_long_t tb_static_string_strrstr(tb_static_string_t const* strin
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_strirstr(tb_static_string_t const* string, tb_size_t p, tb_static_string_t const* s);
+tb_long_t tb_static_string_strirstr(tb_static_string_ref_t string, tb_size_t p, tb_static_string_ref_t s);
/*! reverse to find c-string position
*
@@ -209,7 +212,7 @@ tb_long_t tb_static_string_strirstr(tb_static_string_t const* stri
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_cstrrstr(tb_static_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_static_string_cstrrstr(tb_static_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! reverse to find c-string position and ignore case
*
@@ -219,7 +222,7 @@ tb_long_t tb_static_string_cstrrstr(tb_static_string_t const* stri
*
* @return the real position, no find: -1
*/
-tb_long_t tb_static_string_cstrirstr(tb_static_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_static_string_cstrirstr(tb_static_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! copy string
*
@@ -228,7 +231,7 @@ tb_long_t tb_static_string_cstrirstr(tb_static_string_t const* str
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_strcpy(tb_static_string_t* string, tb_static_string_t const* s);
+tb_char_t const* tb_static_string_strcpy(tb_static_string_ref_t string, tb_static_string_ref_t s);
/*! copy c-string
*
@@ -237,7 +240,7 @@ tb_char_t const* tb_static_string_strcpy(tb_static_string_t* string, tb_s
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_cstrcpy(tb_static_string_t* string, tb_char_t const* s);
+tb_char_t const* tb_static_string_cstrcpy(tb_static_string_ref_t string, tb_char_t const* s);
/*! copy c-string with the given size
*
@@ -247,7 +250,7 @@ tb_char_t const* tb_static_string_cstrcpy(tb_static_string_t* string, tb_
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_cstrncpy(tb_static_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_char_t const* tb_static_string_cstrncpy(tb_static_string_ref_t string, tb_char_t const* s, tb_size_t n);
/*! copy format c-string
*
@@ -256,7 +259,7 @@ tb_char_t const* tb_static_string_cstrncpy(tb_static_string_t* string, tb
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_cstrfcpy(tb_static_string_t* string, tb_char_t const* fmt, ...);
+tb_char_t const* tb_static_string_cstrfcpy(tb_static_string_ref_t string, tb_char_t const* fmt, ...);
/*! append charactor
*
@@ -265,7 +268,7 @@ tb_char_t const* tb_static_string_cstrfcpy(tb_static_string_t* string, tb
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_chrcat(tb_static_string_t* string, tb_char_t c);
+tb_char_t const* tb_static_string_chrcat(tb_static_string_ref_t string, tb_char_t c);
/*! append charactor with the given size
*
@@ -275,7 +278,7 @@ tb_char_t const* tb_static_string_chrcat(tb_static_string_t* string, tb_c
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_chrncat(tb_static_string_t* string, tb_char_t c, tb_size_t n);
+tb_char_t const* tb_static_string_chrncat(tb_static_string_ref_t string, tb_char_t c, tb_size_t n);
/*! append string
*
@@ -284,7 +287,7 @@ tb_char_t const* tb_static_string_chrncat(tb_static_string_t* string, tb_
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_strcat(tb_static_string_t* string, tb_static_string_t const* s);
+tb_char_t const* tb_static_string_strcat(tb_static_string_ref_t string, tb_static_string_ref_t s);
/*! append c-string
*
@@ -293,7 +296,7 @@ tb_char_t const* tb_static_string_strcat(tb_static_string_t* string, tb_s
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_cstrcat(tb_static_string_t* string, tb_char_t const* s);
+tb_char_t const* tb_static_string_cstrcat(tb_static_string_ref_t string, tb_char_t const* s);
/*! append c-string with the given size
*
@@ -303,7 +306,7 @@ tb_char_t const* tb_static_string_cstrcat(tb_static_string_t* string, tb_
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_cstrncat(tb_static_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_char_t const* tb_static_string_cstrncat(tb_static_string_ref_t string, tb_char_t const* s, tb_size_t n);
/*! append format c-string
*
@@ -312,7 +315,7 @@ tb_char_t const* tb_static_string_cstrncat(tb_static_string_t* string, tb
*
* @return the c-string
*/
-tb_char_t const* tb_static_string_cstrfcat(tb_static_string_t* string, tb_char_t const* fmt, ...);
+tb_char_t const* tb_static_string_cstrfcat(tb_static_string_ref_t string, tb_char_t const* fmt, ...);
/*! compare string
*
@@ -321,7 +324,7 @@ tb_char_t const* tb_static_string_cstrfcat(tb_static_string_t* string, tb
*
* @return equal: 0
*/
-tb_long_t tb_static_string_strcmp(tb_static_string_t* string, tb_static_string_t const* s);
+tb_long_t tb_static_string_strcmp(tb_static_string_ref_t string, tb_static_string_ref_t s);
/*! compare string and ignore case
*
@@ -330,7 +333,7 @@ tb_long_t tb_static_string_strcmp(tb_static_string_t* string, tb_s
*
* @return equal: 0
*/
-tb_long_t tb_static_string_strimp(tb_static_string_t* string, tb_static_string_t const* s);
+tb_long_t tb_static_string_strimp(tb_static_string_ref_t string, tb_static_string_ref_t s);
/*! compare c-string
*
@@ -339,7 +342,7 @@ tb_long_t tb_static_string_strimp(tb_static_string_t* string, tb_s
*
* @return equal: 0
*/
-tb_long_t tb_static_string_cstrcmp(tb_static_string_t* string, tb_char_t const* s);
+tb_long_t tb_static_string_cstrcmp(tb_static_string_ref_t string, tb_char_t const* s);
/*! compare c-string and ignore case
*
@@ -348,7 +351,7 @@ tb_long_t tb_static_string_cstrcmp(tb_static_string_t* string, tb_
*
* @return equal: 0
*/
-tb_long_t tb_static_string_cstricmp(tb_static_string_t* string, tb_char_t const* s);
+tb_long_t tb_static_string_cstricmp(tb_static_string_ref_t string, tb_char_t const* s);
/*! compare c-string with given size
*
@@ -358,7 +361,7 @@ tb_long_t tb_static_string_cstricmp(tb_static_string_t* string, tb
*
* @return equal: 0
*/
-tb_long_t tb_static_string_cstrncmp(tb_static_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_long_t tb_static_string_cstrncmp(tb_static_string_ref_t string, tb_char_t const* s, tb_size_t n);
/*! compare c-string with given size and ignore case
*
@@ -368,7 +371,7 @@ tb_long_t tb_static_string_cstrncmp(tb_static_string_t* string, tb
*
* @return equal: 0
*/
-tb_long_t tb_static_string_cstrnicmp(tb_static_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_long_t tb_static_string_cstrnicmp(tb_static_string_ref_t string, tb_char_t const* s, tb_size_t n);
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
diff --git a/core/pkg/tbox.pkg/inc/tbox/string/string.h b/core/pkg/tbox.pkg/inc/tbox/string/string.h
index 6aa8f4135..1380e62b6 100755
--- a/core/pkg/tbox.pkg/inc/tbox/string/string.h
+++ b/core/pkg/tbox.pkg/inc/tbox/string/string.h
@@ -21,8 +21,8 @@
* @ingroup string
*
*/
-#ifndef TB_STRING_SCOPED_STRING_H
-#define TB_STRING_SCOPED_STRING_H
+#ifndef TB_STRING_H
+#define TB_STRING_H
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -40,7 +40,10 @@ __tb_extern_c_enter__
*/
/// the string type
-typedef tb_buffer_t tb_string_t;
+typedef tb_buffer_t tb_string_t;
+
+/// the string ref type
+typedef tb_buffer_ref_t tb_string_ref_t;
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
@@ -52,13 +55,13 @@ typedef tb_buffer_t tb_string_t;
*
* @return tb_true or tb_false
*/
-tb_bool_t tb_string_init(tb_string_t* string);
+tb_bool_t tb_string_init(tb_string_ref_t string);
/*! exit string
*
* @param string the string
*/
-tb_void_t tb_string_exit(tb_string_t* string);
+tb_void_t tb_string_exit(tb_string_ref_t string);
/*! the c-string pointer
*
@@ -66,7 +69,7 @@ tb_void_t tb_string_exit(tb_string_t* string);
*
* @return the c-string
*/
-tb_char_t const* tb_string_cstr(tb_string_t const* string);
+tb_char_t const* tb_string_cstr(tb_string_ref_t string);
/*! the string size
*
@@ -74,13 +77,13 @@ tb_char_t const* tb_string_cstr(tb_string_t const* string);
*
* @return the string size
*/
-tb_size_t tb_string_size(tb_string_t const* string);
+tb_size_t tb_string_size(tb_string_ref_t string);
/*! clear the string
*
* @param string the string
*/
-tb_void_t tb_string_clear(tb_string_t* string);
+tb_void_t tb_string_clear(tb_string_ref_t string);
/*! strip the string
*
@@ -89,7 +92,7 @@ tb_void_t tb_string_clear(tb_string_t* string);
*
* @return the c-string
*/
-tb_char_t const* tb_string_strip(tb_string_t* string, tb_size_t n);
+tb_char_t const* tb_string_strip(tb_string_ref_t string, tb_size_t n);
/*! trim the right spaces for string
*
@@ -97,7 +100,7 @@ tb_char_t const* tb_string_strip(tb_string_t* string, tb_size_t n);
*
* @return the c-string
*/
-tb_char_t const* tb_string_rtrim(tb_string_t* string);
+tb_char_t const* tb_string_rtrim(tb_string_ref_t string);
/*! find charactor position
*
@@ -107,7 +110,7 @@ tb_char_t const* tb_string_rtrim(tb_string_t* string);
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_strchr(tb_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_string_strchr(tb_string_ref_t string, tb_size_t p, tb_char_t c);
/*! find charactor position and ignore case
*
@@ -117,7 +120,7 @@ tb_long_t tb_string_strchr(tb_string_t const* string, tb_size_t p,
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_strichr(tb_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_string_strichr(tb_string_ref_t string, tb_size_t p, tb_char_t c);
/*! reverse to find charactor position
*
@@ -127,7 +130,7 @@ tb_long_t tb_string_strichr(tb_string_t const* string, tb_size_t p
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_strrchr(tb_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_string_strrchr(tb_string_ref_t string, tb_size_t p, tb_char_t c);
/*! reverse to find charactor position and ignore case
*
@@ -137,7 +140,7 @@ tb_long_t tb_string_strrchr(tb_string_t const* string, tb_size_t p
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_strirchr(tb_string_t const* string, tb_size_t p, tb_char_t c);
+tb_long_t tb_string_strirchr(tb_string_ref_t string, tb_size_t p, tb_char_t c);
/*! find string position
*
@@ -147,7 +150,7 @@ tb_long_t tb_string_strirchr(tb_string_t const* string, tb_size_t
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_strstr(tb_string_t const* string, tb_size_t p, tb_string_t const* s);
+tb_long_t tb_string_strstr(tb_string_ref_t string, tb_size_t p, tb_string_ref_t s);
/*! find string position and ignore case
*
@@ -157,7 +160,7 @@ tb_long_t tb_string_strstr(tb_string_t const* string, tb_size_t p,
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_stristr(tb_string_t const* string, tb_size_t p, tb_string_t const* s);
+tb_long_t tb_string_stristr(tb_string_ref_t string, tb_size_t p, tb_string_ref_t s);
/*! find c-string position
*
@@ -167,7 +170,7 @@ tb_long_t tb_string_stristr(tb_string_t const* string, tb_size_t p
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_cstrstr(tb_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_string_cstrstr(tb_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! find c-string position and ignore case
*
@@ -177,7 +180,7 @@ tb_long_t tb_string_cstrstr(tb_string_t const* string, tb_size_t p
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_cstristr(tb_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_string_cstristr(tb_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! reverse to find string position
*
@@ -187,7 +190,7 @@ tb_long_t tb_string_cstristr(tb_string_t const* string, tb_size_t
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_strrstr(tb_string_t const* string, tb_size_t p, tb_string_t const* s);
+tb_long_t tb_string_strrstr(tb_string_ref_t string, tb_size_t p, tb_string_ref_t s);
/*! reverse to find string position and ignore case
*
@@ -197,7 +200,7 @@ tb_long_t tb_string_strrstr(tb_string_t const* string, tb_size_t p
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_strirstr(tb_string_t const* string, tb_size_t p, tb_string_t const* s);
+tb_long_t tb_string_strirstr(tb_string_ref_t string, tb_size_t p, tb_string_ref_t s);
/*! reverse to find c-string position
*
@@ -207,7 +210,7 @@ tb_long_t tb_string_strirstr(tb_string_t const* string, tb_size_t
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_cstrrstr(tb_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_string_cstrrstr(tb_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! reverse to find c-string position and ignore case
*
@@ -217,7 +220,7 @@ tb_long_t tb_string_cstrrstr(tb_string_t const* string, tb_size_t
*
* @return the real position, no find: -1
*/
-tb_long_t tb_string_cstrirstr(tb_string_t const* string, tb_size_t p, tb_char_t const* s);
+tb_long_t tb_string_cstrirstr(tb_string_ref_t string, tb_size_t p, tb_char_t const* s);
/*! copy string
*
@@ -226,7 +229,7 @@ tb_long_t tb_string_cstrirstr(tb_string_t const* string, tb_size_t
*
* @return the c-string
*/
-tb_char_t const* tb_string_strcpy(tb_string_t* string, tb_string_t const* s);
+tb_char_t const* tb_string_strcpy(tb_string_ref_t string, tb_string_ref_t s);
/*! copy c-string
*
@@ -235,7 +238,7 @@ tb_char_t const* tb_string_strcpy(tb_string_t* string, tb_string_t const*
*
* @return the c-string
*/
-tb_char_t const* tb_string_cstrcpy(tb_string_t* string, tb_char_t const* s);
+tb_char_t const* tb_string_cstrcpy(tb_string_ref_t string, tb_char_t const* s);
/*! copy c-string with the given size
*
@@ -245,7 +248,7 @@ tb_char_t const* tb_string_cstrcpy(tb_string_t* string, tb_char_t const*
*
* @return the c-string
*/
-tb_char_t const* tb_string_cstrncpy(tb_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_char_t const* tb_string_cstrncpy(tb_string_ref_t string, tb_char_t const* s, tb_size_t n);
/*! copy format c-string
*
@@ -254,7 +257,7 @@ tb_char_t const* tb_string_cstrncpy(tb_string_t* string, tb_char_t const*
*
* @return the c-string
*/
-tb_char_t const* tb_string_cstrfcpy(tb_string_t* string, tb_char_t const* fmt, ...);
+tb_char_t const* tb_string_cstrfcpy(tb_string_ref_t string, tb_char_t const* fmt, ...);
/*! append charactor
*
@@ -263,7 +266,7 @@ tb_char_t const* tb_string_cstrfcpy(tb_string_t* string, tb_char_t const*
*
* @return the c-string
*/
-tb_char_t const* tb_string_chrcat(tb_string_t* string, tb_char_t c);
+tb_char_t const* tb_string_chrcat(tb_string_ref_t string, tb_char_t c);
/*! append charactor with the given size
*
@@ -273,7 +276,7 @@ tb_char_t const* tb_string_chrcat(tb_string_t* string, tb_char_t c);
*
* @return the c-string
*/
-tb_char_t const* tb_string_chrncat(tb_string_t* string, tb_char_t c, tb_size_t n);
+tb_char_t const* tb_string_chrncat(tb_string_ref_t string, tb_char_t c, tb_size_t n);
/*! append string
*
@@ -282,7 +285,7 @@ tb_char_t const* tb_string_chrncat(tb_string_t* string, tb_char_t c, tb_s
*
* @return the c-string
*/
-tb_char_t const* tb_string_strcat(tb_string_t* string, tb_string_t const* s);
+tb_char_t const* tb_string_strcat(tb_string_ref_t string, tb_string_ref_t s);
/*! append c-string
*
@@ -291,7 +294,7 @@ tb_char_t const* tb_string_strcat(tb_string_t* string, tb_string_t const*
*
* @return the c-string
*/
-tb_char_t const* tb_string_cstrcat(tb_string_t* string, tb_char_t const* s);
+tb_char_t const* tb_string_cstrcat(tb_string_ref_t string, tb_char_t const* s);
/*! append c-string with the given size
*
@@ -301,7 +304,7 @@ tb_char_t const* tb_string_cstrcat(tb_string_t* string, tb_char_t const*
*
* @return the c-string
*/
-tb_char_t const* tb_string_cstrncat(tb_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_char_t const* tb_string_cstrncat(tb_string_ref_t string, tb_char_t const* s, tb_size_t n);
/*! append format c-string
*
@@ -310,7 +313,7 @@ tb_char_t const* tb_string_cstrncat(tb_string_t* string, tb_char_t const*
*
* @return the c-string
*/
-tb_char_t const* tb_string_cstrfcat(tb_string_t* string, tb_char_t const* fmt, ...);
+tb_char_t const* tb_string_cstrfcat(tb_string_ref_t string, tb_char_t const* fmt, ...);
/*! compare string
*
@@ -319,7 +322,7 @@ tb_char_t const* tb_string_cstrfcat(tb_string_t* string, tb_char_t const*
*
* @return equal: 0
*/
-tb_long_t tb_string_strcmp(tb_string_t* string, tb_string_t const* s);
+tb_long_t tb_string_strcmp(tb_string_ref_t string, tb_string_ref_t s);
/*! compare string and ignore case
*
@@ -328,7 +331,7 @@ tb_long_t tb_string_strcmp(tb_string_t* string, tb_string_t const*
*
* @return equal: 0
*/
-tb_long_t tb_string_strimp(tb_string_t* string, tb_string_t const* s);
+tb_long_t tb_string_strimp(tb_string_ref_t string, tb_string_ref_t s);
/*! compare c-string
*
@@ -337,7 +340,7 @@ tb_long_t tb_string_strimp(tb_string_t* string, tb_string_t const*
*
* @return equal: 0
*/
-tb_long_t tb_string_cstrcmp(tb_string_t* string, tb_char_t const* s);
+tb_long_t tb_string_cstrcmp(tb_string_ref_t string, tb_char_t const* s);
/*! compare c-string and ignore case
*
@@ -346,7 +349,7 @@ tb_long_t tb_string_cstrcmp(tb_string_t* string, tb_char_t const*
*
* @return equal: 0
*/
-tb_long_t tb_string_cstricmp(tb_string_t* string, tb_char_t const* s);
+tb_long_t tb_string_cstricmp(tb_string_ref_t string, tb_char_t const* s);
/*! compare c-string with given size
*
@@ -356,7 +359,7 @@ tb_long_t tb_string_cstricmp(tb_string_t* string, tb_char_t const*
*
* @return equal: 0
*/
-tb_long_t tb_string_cstrncmp(tb_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_long_t tb_string_cstrncmp(tb_string_ref_t string, tb_char_t const* s, tb_size_t n);
/*! compare c-string with given size and ignore case
*
@@ -366,7 +369,7 @@ tb_long_t tb_string_cstrncmp(tb_string_t* string, tb_char_t const*
*
* @return equal: 0
*/
-tb_long_t tb_string_cstrnicmp(tb_string_t* string, tb_char_t const* s, tb_size_t n);
+tb_long_t tb_string_cstrnicmp(tb_string_ref_t string, tb_char_t const* s, tb_size_t n);
/* //////////////////////////////////////////////////////////////////////////////////////
* extern