Permalink
Browse files

Remove compiler warnings

  • Loading branch information...
1 parent 8b9aef1 commit 6784d458f74bceb34a67c93bdabf89001290b1de @mattn mattn committed Feb 13, 2013
Showing with 4 additions and 10 deletions.
  1. +1 −1 include/cfunc.h
  2. +0 −1 src/cfunc_platform.c
  3. +1 −2 src/cfunc_rubyvm.c
  4. +1 −1 src/cfunc_struct.c
  5. +1 −3 src/cfunc_type.c
  6. +0 −2 src/vector.c
View
@@ -58,7 +58,7 @@ static inline struct cfunc_state *
cfunc_state(mrb_state *mrb, struct RClass* obj)
{
if(obj == NULL) {
- obj = mrb_object(mrb_vm_const_get(mrb, mrb_intern(mrb, "CFunc")));
+ obj = (struct RClass*) mrb_object(mrb_vm_const_get(mrb, mrb_intern(mrb, "CFunc")));
}
mrb_value state = mrb_mod_cv_get(mrb, obj, mrb_intern(mrb, "cfunc_state"));
return (struct cfunc_state *)mrb_voidp(state);
@@ -32,7 +32,6 @@ cfunc_platform_is_win32(mrb_state *mrb, mrb_value self)
void init_cfunc_platform(mrb_state *mrb, struct RClass* module)
{
- struct cfunc_state *state = cfunc_state(mrb, module);
struct RClass *struct_class = mrb_define_class_under(mrb, module, "Platform", mrb->object_class);
mrb_define_class_method(mrb, struct_class, "is_posix?", cfunc_platform_is_posix, ARGS_NONE());
View
@@ -359,7 +359,6 @@ cfunc_rubyvm_class_thread(mrb_state *mrb, mrb_value klass)
{
// init bindle data with RubyVM object
struct RClass *c = mrb_class_ptr(klass);
- struct cfunc_state *state = cfunc_state(mrb, c);
struct cfunc_rubyvm_data *data = malloc(sizeof(struct cfunc_rubyvm_data));
mrb_value self = mrb_obj_value((struct RObject *)Data_Wrap_Struct(mrb, c, &cfunc_rubyvm_data_type, data));
@@ -394,7 +393,7 @@ init_cfunc_rubyvm(mrb_state *mrb, struct RClass* module)
struct RClass *rubyvm_class = mrb_define_class_under(mrb, module, "RubyVM", mrb->object_class);
state->rubyvm_class = rubyvm_class;
- set_cfunc_state(mrb, (struct RObject*)rubyvm_class, state);
+ set_cfunc_state(mrb, rubyvm_class, state);
mrb_define_class_method(mrb, rubyvm_class, "thread", cfunc_rubyvm_class_thread, ARGS_REQ(1));
mrb_define_method(mrb, rubyvm_class, "dispatch", cfunc_rubyvm_dispatch, ARGS_ANY());
View
@@ -83,7 +83,7 @@ init_cfunc_struct(mrb_state *mrb, struct RClass* module)
{
struct cfunc_state *state = cfunc_state(mrb, module);
struct RClass *struct_class = mrb_define_class_under(mrb, module, "Struct", mrb->object_class);
- set_cfunc_state(mrb, (struct RObject*)struct_class, state);
+ set_cfunc_state(mrb, struct_class, state);
state->struct_class = struct_class;
mrb_define_class_method(mrb, struct_class, "define_struct", cfunc_struct_define_struct, ARGS_REQ(1));
View
@@ -301,7 +301,6 @@ cfunc_uint64_class_get(mrb_state *mrb, mrb_value klass)
mrb_value pointer;
mrb_get_args(mrb, "o", &pointer);
- struct mrb_ffi_type *mft = rclass_to_mrb_ffi_type(mrb, mrb_class_ptr(klass));
uint64_t uint64 = *(uint64_t*)cfunc_pointer_ptr(pointer);
if(uint64 > UINT32_MAX) {
@@ -387,7 +386,6 @@ cfunc_sint64_class_get(mrb_state *mrb, mrb_value klass)
mrb_value pointer;
mrb_get_args(mrb, "o", &pointer);
- struct mrb_ffi_type *mft = rclass_to_mrb_ffi_type(mrb, mrb_class_ptr(klass));
int64_t sint64 = *(int64_t*)cfunc_pointer_ptr(pointer);
if(sint64 > INT32_MAX || sint64 < INT32_MIN) {
@@ -577,7 +575,7 @@ void init_cfunc_type(mrb_state *mrb, struct RClass* module)
struct RClass *type_class = mrb_define_class_under(mrb, module, "Type", mrb->object_class);
MRB_SET_INSTANCE_TT(type_class, MRB_TT_DATA);
state->type_class = type_class;
- set_cfunc_state(mrb, (struct RObject*)type_class, state);
+ set_cfunc_state(mrb, type_class, state);
int ai = mrb_gc_arena_save(mrb);
mrb_define_class_method(mrb, type_class, "refer", cfunc_type_class_refer, ARGS_REQ(1));
View
@@ -70,7 +70,6 @@ vector_p create_vector(){
vector_p subvector(vector_p vec, int start, int end){
vector_p subvec = create_vector();
int i;
- void * val;
for(i=start; i<end; i++){
vector_add(subvec, vec->data[i]);
}
@@ -133,7 +132,6 @@ void vector_remove(vector_p vec, size_t i){
int vector_index(vector_p vec, void* data){
int x;
- void* check;
for(x=0;x<vec->length;++x){
if(vec->data[x] == data){
return x;

0 comments on commit 6784d45

Please sign in to comment.