@@ -16,18 +16,19 @@ VALUE cbasic_alloc(VALUE klass){
1616}
1717
1818VALUE cbasic_binary_op (VALUE self , VALUE operand2 , void (* cwfunc_ptr )(basic_struct * , const basic_struct * , const basic_struct * )){
19- basic_struct * this , * cbasic_operand2 , * cresult ;
19+ basic_struct * this , * cresult ;
2020 VALUE result ;
2121
22- cbasic_operand2 = basic_new_heap ();
22+ basic cbasic_operand2 ;
23+ basic_new_stack (cbasic_operand2 );
2324
2425 Data_Get_Struct (self , basic_struct , this );
2526 sympify (operand2 , cbasic_operand2 );
2627
2728 cresult = basic_new_heap ();
2829 cwfunc_ptr (cresult , this , cbasic_operand2 );
2930 result = Data_Wrap_Struct (Klass_of_Basic (cresult ), NULL , cbasic_free_heap , cresult );
30- basic_free_heap (cbasic_operand2 );
31+ basic_free_stack (cbasic_operand2 );
3132
3233 return result ;
3334}
@@ -89,27 +90,29 @@ VALUE cbasic_diff(VALUE self, VALUE operand2) {
8990}
9091
9192VALUE cbasic_eq (VALUE self , VALUE operand2 ) {
92- basic_struct * this , * cbasic_operand2 ;
93+ basic_struct * this ;
9394
94- cbasic_operand2 = basic_new_heap ();
95+ basic cbasic_operand2 ;
96+ basic_new_stack (cbasic_operand2 );
9597 Data_Get_Struct (self , basic_struct , this );
9698 sympify (operand2 , cbasic_operand2 );
9799
98100 VALUE ret_val = basic_eq (this , cbasic_operand2 ) ? Qtrue : Qfalse ;
99- basic_free_heap (cbasic_operand2 );
101+ basic_free_stack (cbasic_operand2 );
100102
101103 return ret_val ;
102104}
103105
104106VALUE cbasic_neq (VALUE self , VALUE operand2 ) {
105- basic_struct * this , * cbasic_operand2 ;
107+ basic_struct * this ;
106108
107- cbasic_operand2 = basic_new_heap ();
109+ basic cbasic_operand2 ;
110+ basic_new_stack (cbasic_operand2 );
108111 Data_Get_Struct (self , basic_struct , this );
109112 sympify (operand2 , cbasic_operand2 );
110113
111114 VALUE ret_val = basic_neq (this , cbasic_operand2 ) ? Qtrue : Qfalse ;
112- basic_free_heap (cbasic_operand2 );
115+ basic_free_stack (cbasic_operand2 );
113116
114117 return ret_val ;
115118}
0 commit comments