dignifiedquire
f31f341a50
feat: enforce Debug implementations and remove mod types
2019-09-15 16:36:31 +02:00
dignifiedquire
23d49560bf
refactor(location): rename module dc_location -> location
2019-08-26 21:09:40 +02:00
dignifiedquire
bb16849eef
refactor(location): remove most unsafe usage
2019-08-26 21:07:53 +02:00
Alexander Krotov
8a73f84003
Move all unsafe code from dc_array.rs to FFI
2019-08-21 09:30:59 +02:00
Alexander Krotov
e013532e27
Remove unused dc_array_get_string
2019-08-17 01:04:37 +02:00
Friedel Ziegelmayer
3d080d2733
Remove dead code ( #384 )
...
Remove dead code
2019-08-16 11:13:40 +02:00
Dmitry Bogatov
7c7a1b64df
Remove dead code
2019-08-16 04:46:20 +00:00
Dmitry Bogatov
ea661896a1
Do not export more than strictly necessary
2019-08-16 04:46:20 +00:00
Alexander Krotov
fadcd43fee
Move some unsafe dc_array_* functions to FFI
2019-08-16 00:53:32 +03:00
Alexander Krotov
29d4f6888d
Store IDs in dc_array as u32
...
This changes dc_array_get_raw API
2019-08-15 01:54:51 +02:00
Alexander Krotov
5b47409fb0
Remove unused dc_array_* API
2019-08-15 01:54:51 +02:00
dignifiedquire
cfed5c914c
chore: update rust nightly version
2019-08-13 12:20:53 +02:00
Alexander Krotov
4d402f3a06
dc_array: panic on null pointers and out of range indexes
2019-08-13 03:07:13 +03:00
Alexander Krotov
6c95d008e0
Implement From<Vec<u32>> for dc_array_t and use it instead of new()
2019-08-13 01:40:47 +03:00
Simon Laux
8fb25a6340
Cargo fmt: removed two empty llines
2019-08-11 09:04:47 +02:00
Floris Bruynooghe
b6b0849bce
Remove to_cstring() naming convention ambiguity
...
Add a trait for str.strdup() to replace to_cstring() which avoid the
signature ambiguity with .to_string().
Also instruduce CString::yolo() as a shortcut to
CString::new().unwrap() and use it whenever the variable does can be
deallocated by going out of scope. This is less error prone.
Use some Path.to_c_string() functions where possible.
2019-08-01 19:06:39 +02:00
Friedel Ziegelmayer
e7456248a0
Merge pull request #244 from link2xt/dc_location_vec
...
Replace some dc_array_t with Vec<dc_location>
2019-07-31 22:15:35 +02:00
Alexander Krotov
d6dae0a9e8
Make dc_array_sort_ids() safe and move it into impl
2019-07-31 03:21:13 +03:00
Dmitry Bogatov
73298c0273
chore: fix and enforce compiler warnings on CI
2019-07-30 09:58:28 +02:00
Alexander Krotov
2688a397aa
Implement From<Vec<dc_location>> for dc_array_t
2019-07-30 02:32:24 +03:00
Alexander
0cffbaf1e9
refactor: rename dc_array_t::as_ptr() into dc_array_t::into_raw()
...
By convention as_* functions do not consume self by taking the reference.
2019-07-28 20:31:57 +02:00
Alexander Krotov
21d94b1d09
Remove misplaced comment
2019-07-27 19:28:39 +03:00
Alexander Krotov
ae1cbc9596
dc_array: store locations as Vec<dc_location>
2019-07-27 19:28:39 +03:00
Alexander Krotov
1cd7cb541c
Rewrite most location array member accessors
2019-07-27 19:28:39 +03:00
Alexander Krotov
f27dda86ff
Move dc_array_search_id into dc_array_t implementation
2019-07-27 19:28:39 +03:00
Alexander Krotov
8b4acbb63a
Move dc_array_get_ptr inside dc_array_t implementation
2019-07-27 19:28:39 +03:00
Alexander Krotov
928361429e
Move dc_array_get_{uint,id} inside dc_array_t implementation
2019-07-27 19:28:39 +03:00
Alexander Krotov
c17632188a
Avoid using return in dc_array_get_cnt implementation
2019-07-27 19:28:39 +03:00
Alexander Krotov
ea3c89e913
Move dc_array_unref logic inside dc_array_t implementation
...
This will allow to make dc_array_t members private in the future.
2019-07-27 19:28:39 +03:00
Alexander Krotov
ea84edf13a
Implement dc_array_t::len()
2019-07-27 19:28:39 +03:00
Alexander Krotov
c335348f20
Implement dc_array_t::is_empty()
2019-07-27 19:28:39 +03:00
Alexander Krotov
1e91f6a204
Merge dc_array_free_ptr into dc_array_unref
2019-07-27 19:28:39 +03:00
Alexander Krotov
dfd43cbb97
Rename dc_array_new_typed into dc_array_new_locations
...
dc_array_new_typed is only used internally, so we can change its API.
2019-07-27 19:28:39 +03:00
Alexander Krotov
c7a6b3caae
Remove unnecessary check in dc_array_new_typed
...
Allocating Vec with 0 capacity is correct.
2019-07-27 19:28:39 +03:00
Alexander Krotov
f3eea41914
Reimplement dc_array_new without dc_array_new_typed
2019-07-27 19:28:39 +03:00
Alexander Krotov
1f63753a8b
Simplify dc_array_search_id
2019-07-27 19:28:39 +03:00
Alexander Krotov
e796a4c438
Move dc_array_add_{uint,id} implementations into dc_array_t
2019-07-27 19:28:39 +03:00
Alexander Krotov
85dfd65e48
Simplify dc_array_get_string
2019-07-27 19:28:39 +03:00
Alexander Krotov
a323fe68a6
Simplify dc_array_duplicate
2019-07-27 19:28:39 +03:00
Alexander Krotov
05aca2c529
Make dc_array_new and dc_array_new_typed safe
...
Just like Box::into_raw, these functions are safe,
even though the caller is responsible for the allocated structure.
2019-07-27 19:16:42 +03:00
Alexander Krotov
1dfad65afd
dc_array.rs: remove magic field
...
It was always set to DC_ARRAY_MAGIC, except immediately before freeing the memory.
2019-07-27 19:16:42 +03:00
Alexander Krotov
e15e3a1e84
Use Vec to store dc_array_t data
2019-07-27 18:25:24 +03:00
Alexander Krotov
252697b174
Implement dc_array_t::new() and use Box to allocate dc_array_t
2019-07-27 18:25:24 +03:00
Alexander Krotov
7764ab3ff3
Replace C loop with Rust loop in dc_array_search_id
2019-07-27 18:25:24 +03:00
Alexander Krotov
7585dc49e3
Replace C loop with Rust loop in dc_array_free_ptr
2019-07-27 18:25:24 +03:00
Alexander Krotov
f0ae5fcd7c
Add DC_ARRAY_LOCATIONS constant
2019-07-27 18:25:24 +03:00
Alexander Krotov
7cba2b3f66
Remove unused dc_array_sort_strings
2019-07-27 18:25:23 +03:00
Alexander Krotov
a0594338b2
Remove repr(C) from dc_array_t
...
All members of dc_array_t structure are private, C code does not need to interact with them.
2019-07-27 17:14:09 +03:00
Alexander Krotov
9f75a5049e
dc_location: store marker as Option<String> instead of C string
2019-07-25 22:41:33 +02:00
Alexander Krotov
a791f76e4b
Rename _dc_location into dc_location
2019-07-25 22:41:33 +02:00