Skip to content

Commit d92b6d8

Browse files
committed
Fix warnings
1 parent a7b1d13 commit d92b6d8

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

ext/symengine/ruby_basic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ VALUE cbasic_get_args(VALUE self) {
132132
size = vecbasic_size(args);
133133
VALUE ruby_array = rb_ary_new2(size);
134134
int i = 0;
135-
VALUE temp = NULL;
135+
VALUE temp;
136136
for(i = 0; i < size; i++) {
137137
basic_struct *temp_basic = basic_new_heap();
138138
vecbasic_get(args, i, temp_basic);
@@ -154,7 +154,7 @@ VALUE cbasic_free_symbols(VALUE self) {
154154
size = setbasic_size(symbols);
155155
VALUE ruby_array = rb_ary_new2(size);
156156
int i = 0;
157-
VALUE temp = NULL;
157+
VALUE temp;
158158
for(i = 0; i < size; i++) {
159159
basic_struct *temp_basic = basic_new_heap();
160160
setbasic_get(symbols, i, temp_basic);

ext/symengine/ruby_real_mpfr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ VALUE crealmpfr_init(VALUE self, VALUE num_value, VALUE prec_value)
2020
real_mpfr_set_str(cresult, c, prec);
2121
break;
2222
case T_DATA:
23-
c = rb_obj_classname(num_value);
24-
if (strcmp(c, "BigDecimal") == 0) {
23+
if (strcmp(rb_obj_classname(num_value), "BigDecimal") == 0) {
2524
c = RSTRING_PTR(rb_funcall(num_value, rb_intern("to_s"), 1, rb_str_new2("F")));
2625
real_mpfr_set_str(cresult, c, prec);
2726
break;

ext/symengine/ruby_symbol.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#include "ruby_symbol.h"
22

33
VALUE csymbol_init(VALUE self, VALUE name_or_id) {
4-
char *str_ptr;
4+
const char *str_ptr;
55

66
switch (TYPE(name_or_id)) {
7-
case T_STRING:
8-
str_ptr = StringValueCStr(name_or_id);
9-
break;
10-
case T_SYMBOL:
11-
str_ptr = rb_id2name(rb_to_id(name_or_id));
12-
break;
13-
default:
14-
rb_raise(rb_eTypeError, "wrong argument type %s (expected Symbol or String)", rb_obj_classname(name_or_id));
7+
case T_STRING:
8+
str_ptr = StringValueCStr(name_or_id);
9+
break;
10+
case T_SYMBOL:
11+
str_ptr = rb_id2name(rb_to_id(name_or_id));
12+
break;
13+
default:
14+
rb_raise(rb_eTypeError, "wrong argument type %s (expected Symbol or String)", rb_obj_classname(name_or_id));
1515
}
1616

1717
basic_struct *this;

ext/symengine/symengine_utils.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ void sympify(VALUE operand2, basic_struct *cbasic_operand2) {
6060
break;
6161

6262
case T_DATA:
63-
c = rb_obj_classname(operand2);
6463
#ifdef HAVE_SYMENGINE_MPFR
65-
if (strcmp(c, "BigDecimal") == 0) {
64+
if (strcmp(rb_obj_classname(operand2), "BigDecimal") == 0) {
6665
c = RSTRING_PTR( rb_funcall(operand2, rb_intern("to_s"), 1, rb_str_new2("F")) );
6766
real_mpfr_set_str(cbasic_operand2, c, 200);
6867
break;

0 commit comments

Comments
 (0)