Permalink
Browse files

Use byte_address() where we also explicitly use the size of the buffer

  • Loading branch information...
1 parent 162416f commit a2a4faeb76ae9845e3ab4444a5fde34ac189d808 @dbussink dbussink committed Dec 26, 2011
Showing with 5 additions and 2 deletions.
  1. +2 −1 vm/builtin/io.cpp
  2. +3 −1 vm/symboltable.cpp
View
3 vm/builtin/io.cpp
@@ -688,7 +688,8 @@ namespace rubinius {
buf_size = data_size;
}
- int n = ::write(descriptor_->to_native(), buf->c_str(state), buf_size);
+ // We can use byte_address() here since we use an explicit size
+ int n = ::write(descriptor_->to_native(), buf->byte_address(), buf_size);
if(n == -1) Exception::errno_error(state, "write_nonblock");
return Fixnum::from(n);
}
View
4 vm/symboltable.cpp
@@ -144,7 +144,9 @@ namespace rubinius {
return NULL;
}
- const char* bytes = str->c_str(state);
+ // Since we also explicitly use the size, we can safely
+ // use byte_address() here.
+ const char* bytes = (const char*) str->byte_address();
size_t size = str->size();
if(LANGUAGE_18_ENABLED(state)) {

0 comments on commit a2a4fae

Please sign in to comment.