ruby/trema/switch-event.c in trema-0.3.21 vs ruby/trema/switch-event.c in trema-0.4.0
- old
+ new
@@ -16,10 +16,11 @@
*/
#include <assert.h>
#include "ruby.h"
#include "switch-event.h"
+#include "compat.h"
#include "trema.h"
extern VALUE mTrema;
VALUE mSwitchEvent;
@@ -98,11 +99,11 @@
if ( !event_type_symbol_to_enum( type, &c_type ) ) {
warn( "Invalid event type was specified" );
return Qfalse;
}
- const char *c_service_name = StringValuePtr( service_name );
+ const char *c_service_name = RSTRING_PTR( service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "service_name cannot be empty" );
return Qfalse;
}
@@ -147,11 +148,11 @@
if ( !event_type_symbol_to_enum( type, &c_type ) ) {
warn( "Invalid event type was specified" );
return Qfalse;
}
- const char *c_service_name = StringValuePtr( service_name );
+ const char *c_service_name = RSTRING_PTR( service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "service_name cannot be empty" );
return Qfalse;
}
@@ -223,11 +224,11 @@
warn( "Invalid event type was specified" );
return Qfalse;
}
const uint64_t c_dpid = NUM2ULL( dpid );
- const char *c_service_name = StringValuePtr( service_name );
+ const char *c_service_name = RSTRING_PTR( service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "service_name cannot be empty" );
return Qfalse;
}
@@ -275,11 +276,11 @@
warn( "Invalid event type was specified" );
return Qfalse;
}
const uint64_t c_dpid = NUM2ULL( dpid );
- const char *c_service_name = StringValuePtr( service_name );
+ const char *c_service_name = RSTRING_PTR( service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "service_name cannot be empty" );
return Qfalse;
}
@@ -329,13 +330,13 @@
}
const uint64_t c_dpid = NUM2ULL( dpid );
list_element *service_list = NULL;
create_list( &service_list );
- for ( long i = 0 ; i < RARRAY( service_names )->len ; ++i ) {
+ for ( long i = 0 ; i < RARRAY_LEN( service_names ) ; ++i ) {
VALUE ruby_service_name = rb_ary_entry( service_names, i );
- char *c_service_name = StringValuePtr( ruby_service_name );
+ char *c_service_name = RSTRING_PTR( ruby_service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "Ignoring empty service_name" );
continue;
}
append_to_tail( &service_list, c_service_name );
@@ -431,11 +432,11 @@
if ( !event_type_symbol_to_enum( type, &c_type ) ) {
warn( "Invalid event type was specified" );
return Qfalse;
}
- const char *c_service_name = StringValuePtr( service_name );
+ const char *c_service_name = RSTRING_PTR( service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "service_name cannot be empty" );
return Qfalse;
}
@@ -481,11 +482,11 @@
if ( !event_type_symbol_to_enum( type, &c_type ) ) {
warn( "Invalid event type was specified" );
return Qfalse;
}
- const char *c_service_name = StringValuePtr( service_name );
+ const char *c_service_name = RSTRING_PTR( service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "service_name cannot be empty" );
return Qfalse;
}
@@ -533,12 +534,12 @@
return Qfalse;
}
list_element *service_list = NULL;
create_list( &service_list );
- for ( long i = 0 ; i < RARRAY( service_names )->len ; ++i ) {
+ for ( long i = 0 ; i < RARRAY_LEN( service_names ) ; ++i ) {
VALUE ruby_service_name = rb_ary_entry( service_names, i );
- char *c_service_name = StringValuePtr( ruby_service_name );
+ char *c_service_name = RSTRING_PTR( ruby_service_name );
if ( strlen( c_service_name ) == 0 ) {
warn( "Ignoring empty service_name" );
continue;
}
append_to_tail( &service_list, c_service_name );