Skip to content

Commit e792e36

Browse files
authored
Merge pull request #318 from tboox/clos
rename clos to close
2 parents 358c48a + fc810ff commit e792e36

45 files changed

Lines changed: 223 additions & 137 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/demo/coroutine/pipe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/* //////////////////////////////////////////////////////////////////////////////////////
1313
* private implementation
1414
*/
15-
static tb_void_t tb_demo_coroutine_writ(tb_cpointer_t priv)
15+
static tb_void_t tb_demo_coroutine_write(tb_cpointer_t priv)
1616
{
1717
tb_byte_t data[BUFSIZE];
1818
tb_pipe_file_ref_t pipe = (tb_pipe_file_ref_t) priv;
@@ -48,7 +48,7 @@ tb_int_t tb_demo_coroutine_pipe_main(tb_int_t argc, tb_char_t** argv)
4848
if (tb_pipe_file_init_pair(pair, tb_null, 4096))
4949
{
5050
// start coroutines
51-
tb_coroutine_start(scheduler, tb_demo_coroutine_writ, pair[1], 0);
51+
tb_coroutine_start(scheduler, tb_demo_coroutine_write, pair[1], 0);
5252
tb_coroutine_start(scheduler, tb_demo_coroutine_read, pair[0], 0);
5353

5454
// do loop

src/demo/coroutine/spider.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@ static tb_bool_t tb_demo_spider_parser_open(tb_demo_spider_parser_ref_t parser,
300300
} while (0);
301301

302302
// failed?
303-
if (!ok) tb_stream_clos(parser->stream);
303+
if (!ok) tb_stream_close(parser->stream);
304304

305305
// ok?
306306
return ok;
307307
}
308-
static tb_void_t tb_demo_spider_parser_clos(tb_demo_spider_parser_ref_t parser)
308+
static tb_void_t tb_demo_spider_parser_close(tb_demo_spider_parser_ref_t parser)
309309
{
310310
// check
311311
tb_assert_and_check_return(parser);
@@ -315,7 +315,7 @@ static tb_void_t tb_demo_spider_parser_clos(tb_demo_spider_parser_ref_t parser)
315315
parser->offset = 0;
316316

317317
// close stream
318-
if (parser->stream) tb_stream_clos(parser->stream);
318+
if (parser->stream) tb_stream_close(parser->stream);
319319
}
320320
static tb_char_t const* tb_demo_spider_parser_read(tb_demo_spider_parser_ref_t parser)
321321
{
@@ -551,12 +551,12 @@ static tb_void_t tb_demo_spider_page_grab(tb_cpointer_t priv)
551551
}
552552

553553
// close parser
554-
tb_demo_spider_parser_clos(parser);
554+
tb_demo_spider_parser_close(parser);
555555
}
556556
}
557557

558558
// close stream
559-
tb_stream_clos(stream);
559+
tb_stream_close(stream);
560560

561561
// exit url
562562
tb_free(iurl);

src/demo/memory/queue_buffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ tb_int_t tb_demo_memory_queue_buffer_main(tb_int_t argc, tb_char_t** argv)
1212
tb_queue_buffer_t b;
1313
tb_queue_buffer_init(&b, 1024);
1414

15-
tb_queue_buffer_writ(&b, (tb_byte_t const*)"hello", 5);
16-
tb_queue_buffer_writ(&b, (tb_byte_t const*)" ", 1);
17-
tb_queue_buffer_writ(&b, (tb_byte_t const*)"world", 6);
15+
tb_queue_buffer_write(&b, (tb_byte_t const*)"hello", 5);
16+
tb_queue_buffer_write(&b, (tb_byte_t const*)" ", 1);
17+
tb_queue_buffer_write(&b, (tb_byte_t const*)"world", 6);
1818
tb_queue_buffer_read(&b, (tb_byte_t*)d, 1024);
1919
tb_trace_i("%s", d);
2020

src/demo/platform/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tb_int_t tb_demo_platform_file_main(tb_int_t argc, tb_char_t** argv)
3030
// writ file
3131
while (writ < size)
3232
{
33-
tb_long_t real = tb_file_writ(file, buff, tb_min(maxn, size - writ));
33+
tb_long_t real = tb_file_write(file, buff, tb_min(maxn, size - writ));
3434
// tb_trace_i("real: %ld, size: %lu", real, tb_min(maxn, size - writ));
3535
if (real > 0) writ += real;
3636
else if (!real) ;
@@ -89,7 +89,7 @@ tb_int_t tb_demo_platform_file_main(tb_int_t argc, tb_char_t** argv)
8989
tb_memcpy(data + maxn + maxn + maxn, list[3].data, list[3].size);
9090

9191
// writ
92-
tb_long_t real = tb_file_writ(file, data, tb_min((size - writ), (maxn << 2)));
92+
tb_long_t real = tb_file_write(file, data, tb_min((size - writ), (maxn << 2)));
9393
if (real > 0) writ += real;
9494
else if (!real) ;
9595
else break;
@@ -153,7 +153,7 @@ tb_int_t tb_demo_platform_file_main(tb_int_t argc, tb_char_t** argv)
153153
}
154154

155155
// writ
156-
tb_long_t real = tb_file_writv(file, list, 4);
156+
tb_long_t real = tb_file_writev(file, list, 4);
157157
if (real > 0) writ += real;
158158
else if (!real) ;
159159
else break;
@@ -189,7 +189,7 @@ tb_int_t tb_demo_platform_file_main(tb_int_t argc, tb_char_t** argv)
189189
tb_hize_t size = tb_file_size(ifile);
190190
while (writ < size)
191191
{
192-
tb_long_t real = tb_file_writf(ofile, ifile, writ, size - writ);
192+
tb_long_t real = tb_file_writef(ofile, ifile, writ, size - writ);
193193
if (real > 0) writ += real;
194194
else break;
195195
}

src/demo/platform/poller_pipe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static tb_long_t tb_demo_session_read(tb_demo_client_ref_t client)
6262
tb_trace_d("[%p]: read %llu", client->pipe, client->size);
6363
return 0;
6464
}
65-
static tb_int_t tb_demo_session_writ(tb_cpointer_t priv)
65+
static tb_int_t tb_demo_session_write(tb_cpointer_t priv)
6666
{
6767
tb_pipe_file_ref_t pipe = (tb_pipe_file_ref_t)priv;
6868
tb_byte_t data[8192 * 16];
@@ -105,7 +105,7 @@ static tb_void_t tb_demo_poller_open(tb_poller_ref_t poller)
105105
if (tb_pipe_file_init_pair(pair, tb_null, 4096))
106106
{
107107
tb_demo_session_start(poller, pair[0]);
108-
tb_thread_init(tb_null, tb_demo_session_writ, pair[1], 0);
108+
tb_thread_init(tb_null, tb_demo_session_write, pair[1], 0);
109109
}
110110
}
111111
static tb_void_t tb_demo_poller_event(tb_poller_ref_t poller, tb_poller_object_ref_t object, tb_long_t events, tb_cpointer_t priv)

src/demo/platform/process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static tb_void_t tb_demo_process_test_redirect_stdin_only(tb_char_t const* test_
258258
if (file)
259259
{
260260
tb_char_t const* content = "test input\n";
261-
tb_file_writ(file, (tb_byte_t const*)content, tb_strlen(content));
261+
tb_file_write(file, (tb_byte_t const*)content, tb_strlen(content));
262262
tb_file_exit(file);
263263
}
264264

src/demo/platform/stdfile.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
/* //////////////////////////////////////////////////////////////////////////////////////
77
* implementation
88
*/
9-
static tb_void_t tb_test_writ()
9+
static tb_void_t tb_test_write()
1010
{
1111
tb_trace_i("=================== test stdfile writ ===================");
12-
tb_stdfile_writ(tb_stdfile_output(), (tb_byte_t const*)"hello world!\n", tb_strlen("hello world!\n"));
12+
tb_stdfile_write(tb_stdfile_output(), (tb_byte_t const*)"hello world!\n", tb_strlen("hello world!\n"));
1313
}
1414
static tb_void_t tb_test_read()
1515
{
@@ -80,7 +80,7 @@ static tb_void_t tb_test_peek()
8080
*/
8181
tb_int_t tb_demo_platform_stdfile_main(tb_int_t argc, tb_char_t** argv)
8282
{
83-
tb_test_writ();
83+
tb_test_write();
8484
tb_test_putc();
8585
tb_test_puts();
8686
tb_test_read();

src/tbox/database/impl/mysql.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static tb_bool_t tb_database_mysql_stream_impl_open(tb_stream_ref_t stream)
216216
// ok
217217
return tb_true;
218218
}
219-
static tb_bool_t tb_database_mysql_stream_impl_clos(tb_stream_ref_t stream)
219+
static tb_bool_t tb_database_mysql_stream_impl_close(tb_stream_ref_t stream)
220220
{
221221
// check
222222
tb_database_mysql_stream_impl_t* impl = (tb_database_mysql_stream_impl_t*)stream;
@@ -310,7 +310,7 @@ static tb_stream_ref_t tb_database_mysql_stream_impl_init(MYSQL_STMT* statement,
310310
, sizeof(tb_database_mysql_stream_impl_t)
311311
, 0
312312
, tb_database_mysql_stream_impl_open
313-
, tb_database_mysql_stream_impl_clos
313+
, tb_database_mysql_stream_impl_close
314314
, tb_null
315315
, tb_database_mysql_stream_impl_ctrl
316316
, tb_database_mysql_stream_impl_wait
@@ -832,7 +832,7 @@ static tb_bool_t tb_database_mysql_open(tb_database_sql_impl_t* database)
832832
// ok?
833833
return ok;
834834
}
835-
static tb_void_t tb_database_mysql_clos(tb_database_sql_impl_t* database)
835+
static tb_void_t tb_database_mysql_close(tb_database_sql_impl_t* database)
836836
{
837837
// check
838838
tb_database_mysql_t* mysql = tb_database_mysql_cast(database);
@@ -856,7 +856,7 @@ static tb_void_t tb_database_mysql_exit(tb_database_sql_impl_t* database)
856856
tb_assert_and_check_return(mysql);
857857

858858
// close it first
859-
tb_database_mysql_clos(database);
859+
tb_database_mysql_close(database);
860860

861861
// exit bind data
862862
tb_buffer_exit(&mysql->bind_data);
@@ -1631,7 +1631,7 @@ tb_database_sql_ref_t tb_database_mysql_init(tb_url_ref_t url)
16311631
// init database
16321632
mysql->base.type = TB_DATABASE_SQL_TYPE_MYSQL;
16331633
mysql->base.open = tb_database_mysql_open;
1634-
mysql->base.clos = tb_database_mysql_clos;
1634+
mysql->base.clos = tb_database_mysql_close;
16351635
mysql->base.exit = tb_database_mysql_exit;
16361636
mysql->base.done = tb_database_mysql_done;
16371637
mysql->base.begin = tb_database_mysql_begin;

src/tbox/database/impl/sqlite3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static tb_bool_t tb_database_sqlite3_open(tb_database_sql_impl_t* database)
393393
// ok?
394394
return ok;
395395
}
396-
static tb_void_t tb_database_sqlite3_clos(tb_database_sql_impl_t* database)
396+
static tb_void_t tb_database_sqlite3_close(tb_database_sql_impl_t* database)
397397
{
398398
// check
399399
tb_database_sqlite3_t* sqlite = tb_database_sqlite3_cast(database);
@@ -414,7 +414,7 @@ static tb_void_t tb_database_sqlite3_exit(tb_database_sql_impl_t* database)
414414
tb_assert_and_check_return(sqlite);
415415

416416
// close it first
417-
tb_database_sqlite3_clos(database);
417+
tb_database_sqlite3_close(database);
418418

419419
// exit url
420420
tb_url_exit(&database->url);
@@ -864,7 +864,7 @@ tb_database_sql_ref_t tb_database_sqlite3_init(tb_url_ref_t url)
864864
// init database
865865
sqlite->base.type = TB_DATABASE_SQL_TYPE_SQLITE3;
866866
sqlite->base.open = tb_database_sqlite3_open;
867-
sqlite->base.clos = tb_database_sqlite3_clos;
867+
sqlite->base.clos = tb_database_sqlite3_close;
868868
sqlite->base.exit = tb_database_sqlite3_exit;
869869
sqlite->base.done = tb_database_sqlite3_done;
870870
sqlite->base.begin = tb_database_sqlite3_begin;

src/tbox/database/sql.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ tb_bool_t tb_database_sql_open(tb_database_sql_ref_t database)
180180
// ok?
181181
return impl->bopened;
182182
}
183-
tb_void_t tb_database_sql_clos(tb_database_sql_ref_t database)
183+
// DEPRECATED: use tb_database_sql_close instead
184+
tb_void_t tb_database_sql_clos(tb_database_sql_ref_t database) { tb_database_sql_close(database); }
185+
tb_void_t tb_database_sql_close(tb_database_sql_ref_t database)
184186
{
185187
// check
186188
tb_database_sql_impl_t* impl = (tb_database_sql_impl_t*)database;

0 commit comments

Comments
 (0)