about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-22 11:06:24 -0800
committerbors <bors@rust-lang.org>2014-01-22 11:06:24 -0800
commitaedf567a950a22acd183da6b1dd7a7fef92e8351 (patch)
tree03412ae45f9a5a998e2195ea04573b8f4091c7cb /src/libstd/sync
parentde50c56a5c20759565f4cba8b1329fba66cc56c9 (diff)
parent2eb4f05850e25863f05a56b60931e9eb03944b56 (diff)
downloadrust-aedf567a950a22acd183da6b1dd7a7fef92e8351.tar.gz
rust-aedf567a950a22acd183da6b1dd7a7fef92e8351.zip
auto merge of #10943 : fhahn/rust/issue-7313-replace-c-types, r=alexcrichton
I've started working on a patch for #7313 . So far I tried to replace C types in `src/libstd/unstable/*` and related files.

So far, I have two questions. Is there a convention for passing pointers around in `std` as Rust types? Sometimes pointers are passed around as `*c_char` (which seems to be an `*i8`), `*c_void` or `*u8`, which leads to a lot of casts. E.g: [`exchange_malloc`](https://github.com/fhahn/rust/compare/issue-7313-replace-c-types?expand=1#diff-39f44b8c3f4496abab854b3425ac1617R60) used to return a `*c_char` but the function in turn only calls `malloc_raw` which returns a `*c_void`.
Is there a specific reason for this?

The second question is about `CString` and related functions like `with_c_str`. At the moment these functions use `*c_char*`. Should I replace it with `*u8` or keep it, because it's an wrapper around classical C strings?
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/atomics.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstd/sync/atomics.rs b/src/libstd/sync/atomics.rs
index bc9d99c0f37..30d9ede8a43 100644
--- a/src/libstd/sync/atomics.rs
+++ b/src/libstd/sync/atomics.rs
@@ -24,7 +24,6 @@
 use unstable::intrinsics;
 use cast;
 use option::{Option,Some,None};
-use libc::c_void;
 use ops::Drop;
 use util::NonCopyable;
 
@@ -73,7 +72,7 @@ pub struct AtomicPtr<T> {
  */
 #[unsafe_no_drop_flag]
 pub struct AtomicOption<T> {
-    priv p: *mut c_void
+    priv p: *mut u8
 }
 
 pub enum Ordering {