Skip to content

Commit

Permalink
Remove compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Feb 13, 2013
1 parent 8b9aef1 commit 6784d45
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/cfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/cfunc_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions src/cfunc_rubyvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/cfunc_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 1 addition & 3 deletions src/cfunc_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 0 additions & 2 deletions src/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6784d45

Please sign in to comment.