@@ -287,7 +287,7 @@ static VALUE rb_mysql_client_escape(RB_MYSQL_UNUSED VALUE klass, VALUE str) {
287
287
oldLen = RSTRING_LEN (str );
288
288
newStr = xmalloc (oldLen * 2 + 1 );
289
289
290
- newLen = mysql_escape_string ((char * )newStr , StringValuePtr (str ), oldLen );
290
+ newLen = mysql_escape_string ((char * )newStr , RSTRING_PTR (str ), oldLen );
291
291
if (newLen == oldLen ) {
292
292
/* no need to return a new ruby string if nothing changed */
293
293
xfree (newStr );
@@ -337,12 +337,12 @@ static VALUE rb_connect(VALUE self, VALUE user, VALUE pass, VALUE host, VALUE po
337
337
VALUE rv ;
338
338
GET_CLIENT (self );
339
339
340
- args .host = NIL_P (host ) ? NULL : StringValuePtr (host );
341
- args .unix_socket = NIL_P (socket ) ? NULL : StringValuePtr (socket );
340
+ args .host = NIL_P (host ) ? NULL : StringValueCStr (host );
341
+ args .unix_socket = NIL_P (socket ) ? NULL : StringValueCStr (socket );
342
342
args .port = NIL_P (port ) ? 0 : NUM2INT (port );
343
- args .user = NIL_P (user ) ? NULL : StringValuePtr (user );
344
- args .passwd = NIL_P (pass ) ? NULL : StringValuePtr (pass );
345
- args .db = NIL_P (database ) ? NULL : StringValuePtr (database );
343
+ args .user = NIL_P (user ) ? NULL : StringValueCStr (user );
344
+ args .passwd = NIL_P (pass ) ? NULL : StringValueCStr (pass );
345
+ args .db = NIL_P (database ) ? NULL : StringValueCStr (database );
346
346
args .mysql = wrapper -> client ;
347
347
args .client_flag = NUM2ULONG (flags );
348
348
@@ -669,7 +669,7 @@ static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
669
669
/* ensure the string is in the encoding the connection is expecting */
670
670
args .sql = rb_str_export_to_enc (args .sql , conn_enc );
671
671
#endif
672
- args .sql_ptr = StringValuePtr (args .sql );
672
+ args .sql_ptr = RSTRING_PTR (args .sql );
673
673
args .sql_len = RSTRING_LEN (args .sql );
674
674
675
675
/* see if this connection is still waiting on a result from a previous query */
@@ -736,7 +736,7 @@ static VALUE rb_mysql_client_real_escape(VALUE self, VALUE str) {
736
736
oldLen = RSTRING_LEN (str );
737
737
newStr = xmalloc (oldLen * 2 + 1 );
738
738
739
- newLen = mysql_real_escape_string (wrapper -> client , (char * )newStr , StringValuePtr (str ), oldLen );
739
+ newLen = mysql_real_escape_string (wrapper -> client , (char * )newStr , RSTRING_PTR (str ), oldLen );
740
740
if (newLen == oldLen ) {
741
741
/* no need to return a new ruby string if nothing changed */
742
742
xfree (newStr );
@@ -800,17 +800,17 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) {
800
800
break ;
801
801
802
802
case MYSQL_READ_DEFAULT_FILE :
803
- charval = (const char * )StringValuePtr (value );
803
+ charval = (const char * )StringValueCStr (value );
804
804
retval = charval ;
805
805
break ;
806
806
807
807
case MYSQL_READ_DEFAULT_GROUP :
808
- charval = (const char * )StringValuePtr (value );
808
+ charval = (const char * )StringValueCStr (value );
809
809
retval = charval ;
810
810
break ;
811
811
812
812
case MYSQL_INIT_COMMAND :
813
- charval = (const char * )StringValuePtr (value );
813
+ charval = (const char * )StringValueCStr (value );
814
814
retval = charval ;
815
815
break ;
816
816
@@ -987,7 +987,7 @@ static VALUE rb_mysql_client_select_db(VALUE self, VALUE db)
987
987
REQUIRE_CONNECTED (wrapper );
988
988
989
989
args .mysql = wrapper -> client ;
990
- args .db = StringValuePtr (db );
990
+ args .db = StringValueCStr (db );
991
991
992
992
if (rb_thread_call_without_gvl (nogvl_select_db , & args , RUBY_UBF_IO , 0 ) == Qfalse )
993
993
rb_raise_mysql2_error (wrapper );
@@ -1183,11 +1183,11 @@ static VALUE set_ssl_options(VALUE self, VALUE key, VALUE cert, VALUE ca, VALUE
1183
1183
GET_CLIENT (self );
1184
1184
1185
1185
mysql_ssl_set (wrapper -> client ,
1186
- NIL_P (key ) ? NULL : StringValuePtr (key ),
1187
- NIL_P (cert ) ? NULL : StringValuePtr (cert ),
1188
- NIL_P (ca ) ? NULL : StringValuePtr (ca ),
1189
- NIL_P (capath ) ? NULL : StringValuePtr (capath ),
1190
- NIL_P (cipher ) ? NULL : StringValuePtr (cipher ));
1186
+ NIL_P (key ) ? NULL : StringValueCStr (key ),
1187
+ NIL_P (cert ) ? NULL : StringValueCStr (cert ),
1188
+ NIL_P (ca ) ? NULL : StringValueCStr (ca ),
1189
+ NIL_P (capath ) ? NULL : StringValueCStr (capath ),
1190
+ NIL_P (cipher ) ? NULL : StringValueCStr (cipher ));
1191
1191
1192
1192
return self ;
1193
1193
}
0 commit comments