Skip to content

Commit cb5b9a4

Browse files
committed
Rename local_data methods/types for less keystrokes
1 parent 5c3a2e7 commit cb5b9a4

File tree

12 files changed

+94
-84
lines changed

12 files changed

+94
-84
lines changed

src/libextra/rl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ fn complete_key(_v: @CompletionCb) {}
7272

7373
/// Bind to the main completion callback
7474
pub unsafe fn complete(cb: CompletionCb) {
75-
local_data::local_data_set(complete_key, @(cb));
75+
local_data::set(complete_key, @(cb));
7676

7777
extern fn callback(line: *c_char, completions: *()) {
7878
unsafe {
79-
let cb = *local_data::local_data_get(complete_key)
79+
let cb = *local_data::get(complete_key)
8080
.get();
8181

8282
do cb(str::raw::from_c_str(line)) |suggestion| {

src/libextra/sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,11 +1204,11 @@ mod big_tests {
12041204
#[unsafe_destructor]
12051205
impl<'self> Drop for LVal<'self> {
12061206
fn drop(&self) {
1207-
let x = unsafe { local_data::local_data_get(self.key) };
1207+
let x = unsafe { local_data::get(self.key) };
12081208
match x {
12091209
Some(@y) => {
12101210
unsafe {
1211-
local_data::local_data_set(self.key, @(y+1));
1211+
local_data::set(self.key, @(y+1));
12121212
}
12131213
}
12141214
_ => fail!("Expected key to work"),

src/librustc/middle/trans/base.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn task_local_insn_key(_v: @~[&'static str]) {}
9292

9393
pub fn with_insn_ctxt(blk: &fn(&[&'static str])) {
9494
unsafe {
95-
let opt = local_data::local_data_get(task_local_insn_key);
95+
let opt = local_data::get(task_local_insn_key);
9696
if opt.is_some() {
9797
blk(*opt.unwrap());
9898
}
@@ -101,7 +101,7 @@ pub fn with_insn_ctxt(blk: &fn(&[&'static str])) {
101101

102102
pub fn init_insn_ctxt() {
103103
unsafe {
104-
local_data::local_data_set(task_local_insn_key, @~[]);
104+
local_data::set(task_local_insn_key, @~[]);
105105
}
106106
}
107107

@@ -111,7 +111,7 @@ pub struct _InsnCtxt { _x: () }
111111
impl Drop for _InsnCtxt {
112112
fn drop(&self) {
113113
unsafe {
114-
do local_data::local_data_modify(task_local_insn_key) |c| {
114+
do local_data::modify(task_local_insn_key) |c| {
115115
do c.map_consume |ctx| {
116116
let mut ctx = copy *ctx;
117117
ctx.pop();
@@ -125,7 +125,7 @@ impl Drop for _InsnCtxt {
125125
pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
126126
debug!("new InsnCtxt: %s", s);
127127
unsafe {
128-
do local_data::local_data_modify(task_local_insn_key) |c| {
128+
do local_data::modify(task_local_insn_key) |c| {
129129
do c.map_consume |ctx| {
130130
let mut ctx = copy *ctx;
131131
ctx.push(s);

src/librustc/middle/trans/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ impl Drop for CrateContext {
241241

242242
fn task_local_llcx_key(_v: @ContextRef) {}
243243
pub fn task_llcx() -> ContextRef {
244-
let opt = unsafe { local_data::local_data_get(task_local_llcx_key) };
244+
let opt = unsafe { local_data::get(task_local_llcx_key) };
245245
*opt.expect("task-local LLVMContextRef wasn't ever set!")
246246
}
247247

248248
unsafe fn set_task_llcx(c: ContextRef) {
249-
local_data::local_data_set(task_local_llcx_key, @c);
249+
local_data::set(task_local_llcx_key, @c);
250250
}
251251

252252
unsafe fn unset_task_llcx() {
253-
local_data::local_data_pop(task_local_llcx_key);
253+
local_data::pop(task_local_llcx_key);
254254
}

src/librusti/program.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl Program {
144144
let key = ::std::sys::Closure{ code: %? as *(),
145145
env: ::std::ptr::null() };
146146
let key = ::std::cast::transmute(key);
147-
*::std::local_data::local_data_get(key).unwrap()
147+
*::std::local_data::get(key).unwrap()
148148
};\n", key.code as uint));
149149

150150
// Using this __tls_map handle, deserialize each variable binding that
@@ -227,7 +227,7 @@ impl Program {
227227
map.insert(copy *name, @copy value.data);
228228
}
229229
unsafe {
230-
local_data::local_data_set(tls_key, @map);
230+
local_data::set(tls_key, @map);
231231
}
232232
}
233233

@@ -236,7 +236,7 @@ impl Program {
236236
/// it updates this cache with the new values of each local variable.
237237
pub fn consume_cache(&mut self) {
238238
let map = unsafe {
239-
local_data::local_data_pop(tls_key).expect("tls is empty")
239+
local_data::pop(tls_key).expect("tls is empty")
240240
};
241241
do map.consume |name, value| {
242242
match self.local_vars.find_mut(&name) {

src/libstd/condition.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#[allow(missing_doc)];
1414

15-
use local_data::{local_data_pop, local_data_set};
1615
use local_data;
1716
use prelude::*;
1817

@@ -26,14 +25,14 @@ pub struct Handler<T, U> {
2625

2726
pub struct Condition<'self, T, U> {
2827
name: &'static str,
29-
key: local_data::LocalDataKey<'self, @Handler<T, U>>
28+
key: local_data::Key<'self, @Handler<T, U>>
3029
}
3130

3231
impl<'self, T, U> Condition<'self, T, U> {
3332
pub fn trap(&'self self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
3433
unsafe {
3534
let p : *RustClosure = ::cast::transmute(&h);
36-
let prev = local_data::local_data_get(self.key);
35+
let prev = local_data::get(self.key);
3736
let h = @Handler { handle: *p, prev: prev };
3837
Trap { cond: self, handler: h }
3938
}
@@ -46,7 +45,7 @@ impl<'self, T, U> Condition<'self, T, U> {
4645

4746
pub fn raise_default(&self, t: T, default: &fn() -> U) -> U {
4847
unsafe {
49-
match local_data_pop(self.key) {
48+
match local_data::pop(self.key) {
5049
None => {
5150
debug!("Condition.raise: found no handler");
5251
default()
@@ -55,12 +54,12 @@ impl<'self, T, U> Condition<'self, T, U> {
5554
debug!("Condition.raise: found handler");
5655
match handler.prev {
5756
None => {}
58-
Some(hp) => local_data_set(self.key, hp)
57+
Some(hp) => local_data::set(self.key, hp)
5958
}
6059
let handle : &fn(T) -> U =
6160
::cast::transmute(handler.handle);
6261
let u = handle(t);
63-
local_data_set(self.key, handler);
62+
local_data::set(self.key, handler);
6463
u
6564
}
6665
}
@@ -78,7 +77,7 @@ impl<'self, T, U> Trap<'self, T, U> {
7877
unsafe {
7978
let _g = Guard { cond: self.cond };
8079
debug!("Trap: pushing handler to TLS");
81-
local_data_set(self.cond.key, self.handler);
80+
local_data::set(self.cond.key, self.handler);
8281
inner()
8382
}
8483
}
@@ -93,12 +92,12 @@ impl<'self, T, U> Drop for Guard<'self, T, U> {
9392
fn drop(&self) {
9493
unsafe {
9594
debug!("Guard: popping handler from TLS");
96-
let curr = local_data_pop(self.cond.key);
95+
let curr = local_data::pop(self.cond.key);
9796
match curr {
9897
None => {}
9998
Some(h) => match h.prev {
10099
None => {}
101-
Some(hp) => local_data_set(self.cond.key, hp)
100+
Some(hp) => local_data::set(self.cond.key, hp)
102101
}
103102
}
104103
}

0 commit comments

Comments
 (0)