Skip to content

Commit 3df9074

Browse files
committed
t100
1 parent 9028396 commit 3df9074

File tree

2 files changed

+15
-42
lines changed

2 files changed

+15
-42
lines changed

src/rust/lib_ccxr/src/isdbs/isdbs.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ pub unsafe fn freep(arg: *mut *mut c_void) {
7171
}
7272
}
7373

74-
const LIST_POISON1: *mut ListHead = 0x001 as *mut ListHead;
75-
const LIST_POISON2: *mut ListHead = 0x002 as *mut ListHead;
74+
pub const LIST_POISON1: *mut ListHead = 0x001 as *mut ListHead;
75+
pub const LIST_POISON2: *mut ListHead = 0x002 as *mut ListHead;
7676

7777
#[no_mangle]
78-
unsafe fn __list_del(prev: *mut ListHead, next: *mut ListHead) {
78+
pub unsafe fn __list_del(prev: *mut ListHead, next: *mut ListHead) {
7979
(*next).prev = prev;
8080
(*prev).next = next;
8181
}
@@ -205,7 +205,7 @@ pub unsafe fn list_add_tail(elem: *mut ListHead, head: *mut ListHead) {
205205
__list_add(elem, (*head).prev, head);
206206
}
207207

208-
fn list_for_each_entry<F>(head: *mut ListHead, member: usize, mut func: F)
208+
pub fn list_for_each_entry<F>(head: *mut ListHead, member: usize, mut func: F)
209209
where
210210
F: FnMut(*mut ISDBText),
211211
{
@@ -219,7 +219,7 @@ where
219219
}
220220
}
221221

222-
fn list_add(elem: &mut ListHead, head: &mut ListHead) {
222+
pub fn list_add(elem: &mut ListHead, head: &mut ListHead) {
223223
unsafe {
224224
__list_add(elem, head, (*head).next);
225225
}
@@ -313,7 +313,7 @@ pub fn ccx_strstr_ignorespace(str1: *const c_char, str2: *const c_char) -> i32 {
313313
}
314314
}
315315

316-
fn list_empty(head: &ListHead) -> bool {
316+
pub fn list_empty(head: &ListHead) -> bool {
317317
head.next as *mut _ == head as *const _ as *mut _
318318
}
319319

src/rust/lib_ccxr/src/isdbs/tests.rs

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use std::os::raw::{c_char, c_int, c_long, c_uchar, c_uint, c_ulonglong, c_void};
55
use crate::isdbs::isdbd::*;
66
use crate::isdbs::isdbs::*;
77

8+
use std::ffi::CStr;
9+
810
#[cfg(test)]
911
mod tests {
1012
use super::*;
@@ -123,12 +125,7 @@ mod tests {
123125
font_size: 0,
124126
font_scale: FScale { fscx: 0, fscy: 0 },
125127
cell_spacing: 0,
126-
cursor_pos: DispArea {
127-
x: 0,
128-
y: 0,
129-
w: 0,
130-
h: 0,
131-
},
128+
cursor_pos: ISDBPos { x: 0, y: 0 },
132129
ccc: 0,
133130
acps: 0,
134131
},
@@ -162,12 +159,7 @@ mod tests {
162159
font_scale: FScale { fscx: 0, fscy: 0 },
163160
format: WritingFormat::None,
164161
cell_spacing: 0,
165-
cursor_pos: DispArea {
166-
x: 0,
167-
y: 0,
168-
w: 0,
169-
h: 0,
170-
},
162+
cursor_pos: ISDBPos { x: 0, y: 0 },
171163
ccc: 0,
172164
acps: 0,
173165
};
@@ -220,12 +212,7 @@ mod tests {
220212
},
221213
format: WritingFormat::None,
222214
cell_spacing: 0,
223-
cursor_pos: DispArea {
224-
x: 0,
225-
y: 0,
226-
w: 0,
227-
h: 0,
228-
},
215+
cursor_pos: ISDBPos { x: 0, y: 0 },
229216
ccc: 0,
230217
acps: 0,
231218
};
@@ -290,9 +277,6 @@ mod tests {
290277
}
291278
}
292279

293-
use super::*;
294-
use std::ptr;
295-
296280
#[test]
297281
fn test___list_del() {
298282
let mut head = ListHead {
@@ -411,9 +395,6 @@ mod tests {
411395
}
412396
}
413397

414-
use super::*;
415-
use std::ptr;
416-
417398
#[test]
418399
fn test_list_for_each_entry_safe() {
419400
let mut head = ListHead {
@@ -685,12 +666,7 @@ mod tests {
685666
},
686667
format: WritingFormat::None,
687668
cell_spacing: 0,
688-
cursor_pos: DispArea {
689-
x: 0,
690-
y: 0,
691-
w: 0,
692-
h: 0,
693-
},
669+
cursor_pos: ISDBPos { x: 0, y: 0 },
694670
ccc: 0,
695671
acps: 0,
696672
};
@@ -719,7 +695,7 @@ mod tests {
719695
buf: unsafe { alloc(Layout::from_size_align(128, 1).unwrap()) } as *mut i8,
720696
used: 0,
721697
len: 128,
722-
pos: Position { x: 0, y: 0 },
698+
pos: ISDBPos { x: 0, y: 0 },
723699
txt_tail: ptr::null_mut(),
724700
timestamp: 0,
725701
refcount: 0,
@@ -737,9 +713,6 @@ mod tests {
737713
}
738714
}
739715

740-
use super::*;
741-
use std::ptr;
742-
743716
#[test]
744717
fn test_list_add() {
745718
let mut head = ListHead {
@@ -893,7 +866,7 @@ mod tests {
893866
}
894867

895868
#[test]
896-
fn test_ccx_strstr_ignorespace() {
869+
fn test_ccx_strstr_ignorespace_1() {
897870
let str1 = CString::new("hello world").unwrap();
898871
let str2 = CString::new("hello world").unwrap();
899872
let result = ccx_strstr_ignorespace(str1.as_ptr(), str2.as_ptr());
@@ -980,7 +953,7 @@ mod tests {
980953
}
981954

982955
#[test]
983-
fn test_ccx_strstr_ignorespace() {
956+
fn test_ccx_strstr_ignorespace_2() {
984957
let str1 = CString::new("hello world").unwrap();
985958
let str2 = CString::new("hello world").unwrap();
986959
let result = ccx_strstr_ignorespace(str1.as_ptr(), str2.as_ptr());

0 commit comments

Comments
 (0)