@@ -277,7 +277,7 @@ static VALUE rb_mysql_client_escape(RB_MYSQL_UNUSED VALUE klass, VALUE str) {
277
277
oldLen = RSTRING_LEN (str );
278
278
newStr = xmalloc (oldLen * 2 + 1 );
279
279
280
- newLen = mysql_escape_string ((char * )newStr , StringValuePtr (str ), oldLen );
280
+ newLen = mysql_escape_string ((char * )newStr , RSTRING_PTR (str ), oldLen );
281
281
if (newLen == oldLen ) {
282
282
/* no need to return a new ruby string if nothing changed */
283
283
xfree (newStr );
@@ -326,12 +326,12 @@ static VALUE rb_connect(VALUE self, VALUE user, VALUE pass, VALUE host, VALUE po
326
326
VALUE rv ;
327
327
GET_CLIENT (self );
328
328
329
- args .host = NIL_P (host ) ? NULL : StringValuePtr (host );
330
- args .unix_socket = NIL_P (socket ) ? NULL : StringValuePtr (socket );
329
+ args .host = NIL_P (host ) ? NULL : StringValueCStr (host );
330
+ args .unix_socket = NIL_P (socket ) ? NULL : StringValueCStr (socket );
331
331
args .port = NIL_P (port ) ? 0 : NUM2INT (port );
332
- args .user = NIL_P (user ) ? NULL : StringValuePtr (user );
333
- args .passwd = NIL_P (pass ) ? NULL : StringValuePtr (pass );
334
- args .db = NIL_P (database ) ? NULL : StringValuePtr (database );
332
+ args .user = NIL_P (user ) ? NULL : StringValueCStr (user );
333
+ args .passwd = NIL_P (pass ) ? NULL : StringValueCStr (pass );
334
+ args .db = NIL_P (database ) ? NULL : StringValueCStr (database );
335
335
args .mysql = wrapper -> client ;
336
336
args .client_flag = NUM2ULONG (flags );
337
337
@@ -663,7 +663,7 @@ static VALUE rb_query(VALUE self, VALUE sql, VALUE current) {
663
663
#else
664
664
args .sql = sql ;
665
665
#endif
666
- args .sql_ptr = StringValuePtr (args .sql );
666
+ args .sql_ptr = RSTRING_PTR (args .sql );
667
667
args .sql_len = RSTRING_LEN (args .sql );
668
668
args .wrapper = wrapper ;
669
669
@@ -717,7 +717,7 @@ static VALUE rb_mysql_client_real_escape(VALUE self, VALUE str) {
717
717
oldLen = RSTRING_LEN (str );
718
718
newStr = xmalloc (oldLen * 2 + 1 );
719
719
720
- newLen = mysql_real_escape_string (wrapper -> client , (char * )newStr , StringValuePtr (str ), oldLen );
720
+ newLen = mysql_real_escape_string (wrapper -> client , (char * )newStr , RSTRING_PTR (str ), oldLen );
721
721
if (newLen == oldLen ) {
722
722
/* no need to return a new ruby string if nothing changed */
723
723
xfree (newStr );
@@ -781,17 +781,17 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) {
781
781
break ;
782
782
783
783
case MYSQL_READ_DEFAULT_FILE :
784
- charval = (const char * )StringValuePtr (value );
784
+ charval = (const char * )StringValueCStr (value );
785
785
retval = charval ;
786
786
break ;
787
787
788
788
case MYSQL_READ_DEFAULT_GROUP :
789
- charval = (const char * )StringValuePtr (value );
789
+ charval = (const char * )StringValueCStr (value );
790
790
retval = charval ;
791
791
break ;
792
792
793
793
case MYSQL_INIT_COMMAND :
794
- charval = (const char * )StringValuePtr (value );
794
+ charval = (const char * )StringValueCStr (value );
795
795
retval = charval ;
796
796
break ;
797
797
@@ -961,7 +961,7 @@ static VALUE rb_mysql_client_select_db(VALUE self, VALUE db)
961
961
REQUIRE_CONNECTED (wrapper );
962
962
963
963
args .mysql = wrapper -> client ;
964
- args .db = StringValuePtr (db );
964
+ args .db = StringValueCStr (db );
965
965
966
966
if (rb_thread_call_without_gvl (nogvl_select_db , & args , RUBY_UBF_IO , 0 ) == Qfalse )
967
967
rb_raise_mysql2_error (wrapper );
@@ -1155,11 +1155,11 @@ static VALUE set_ssl_options(VALUE self, VALUE key, VALUE cert, VALUE ca, VALUE
1155
1155
GET_CLIENT (self );
1156
1156
1157
1157
mysql_ssl_set (wrapper -> client ,
1158
- NIL_P (key ) ? NULL : StringValuePtr (key ),
1159
- NIL_P (cert ) ? NULL : StringValuePtr (cert ),
1160
- NIL_P (ca ) ? NULL : StringValuePtr (ca ),
1161
- NIL_P (capath ) ? NULL : StringValuePtr (capath ),
1162
- NIL_P (cipher ) ? NULL : StringValuePtr (cipher ));
1158
+ NIL_P (key ) ? NULL : StringValueCStr (key ),
1159
+ NIL_P (cert ) ? NULL : StringValueCStr (cert ),
1160
+ NIL_P (ca ) ? NULL : StringValueCStr (ca ),
1161
+ NIL_P (capath ) ? NULL : StringValueCStr (capath ),
1162
+ NIL_P (cipher ) ? NULL : StringValueCStr (cipher ));
1163
1163
1164
1164
return self ;
1165
1165
}
0 commit comments