Skip to content

Commit b009e87

Browse files
committed
refactor(sys): solve taos_option core
1 parent e4d5f8d commit b009e87

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

taos-ws-sys/src/native/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(unused_variables)]
22

3-
use std::ffi::{c_char, c_int, c_void, CStr, VaList};
3+
use std::ffi::{c_char, c_int, c_void, CStr};
44
use std::ptr::{null, null_mut};
55
use std::sync::RwLock;
66

@@ -134,13 +134,12 @@ pub enum TSDB_OPTION {
134134

135135
static PARAMS: Lazy<RwLock<String>> = Lazy::new(|| RwLock::new(String::new()));
136136

137-
// todo
138137
#[allow(clippy::just_underscores_and_digits)]
139138
#[no_mangle]
140139
pub unsafe extern "C" fn taos_options(
141140
option: TSDB_OPTION,
142141
arg: *const c_void,
143-
mut varargs: VaList,
142+
mut varargs: ...
144143
) -> c_int {
145144
let mut params = Vec::new();
146145

taos-ws-sys/src/native/stub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(unused_variables)]
22

3-
use std::ffi::{c_char, c_int, c_ulong, c_void, VaList};
3+
use std::ffi::{c_char, c_int, c_ulong, c_void};
44

55
use super::query::{__taos_async_fn_t, TAOS_FIELD};
66
use super::stmt::TAOS_FIELD_E;
@@ -31,7 +31,7 @@ pub unsafe extern "C" fn taos_options_connection(
3131
taos: *mut TAOS,
3232
option: TSDB_OPTION_CONNECTION,
3333
arg: *const c_void,
34-
varargs: VaList,
34+
varargs: ...
3535
) -> c_int {
3636
todo!()
3737
}

taos-ws-sys/tests/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FLAGS=-I. -I../../target/debug/ -L. -L../../target/debug/ -ltaosws
1+
DEBUG_PATH=../../target/debug
2+
FLAGS=-I${DEBUG_PATH} -L${DEBUG_PATH} -Wl,-rpath=${DEBUG_PATH} -ltaosws
23

34
test_native:
4-
gcc -g test_native.c ${FLAGS} -o ../../target/test_native && ../../target/test_native
5+
gcc -g test_native.c ${FLAGS} -o ${DEBUG_PATH}/test_native
6+
./${DEBUG_PATH}/test_native

taos-ws-sys/tests/test_native.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
#include <assert.h>
12
#include "taos.h"
23

34
int main()
45
{
56
init_log();
67

78
int code = taos_options(TSDB_OPTION_LOCALE, NULL, "group.id", "10s", "enable.auto.commit", "false", NULL);
8-
if (code != 0)
9-
{
10-
return 1;
11-
}
9+
assert(code == 0);
1210

1311
return 0;
1412
}

0 commit comments

Comments
 (0)