move most previously global symbols to static to prevent conflicts (thanks for catching this Eric)
This commit is contained in:
parent
2bb8721e84
commit
12c022c8aa
|
@ -2,9 +2,10 @@
|
|||
#include <client.h>
|
||||
|
||||
VALUE cMysql2Client;
|
||||
extern VALUE mMysql2, cMysql2Error, intern_encoding_from_charset;
|
||||
extern ID sym_id, sym_version, sym_async, sym_symbolize_keys, sym_as, sym_array;
|
||||
extern ID intern_merge;
|
||||
extern VALUE mMysql2, cMysql2Error;
|
||||
static VALUE intern_encoding_from_charset;
|
||||
static ID sym_id, sym_version, sym_async, sym_symbolize_keys, sym_as, sym_array;
|
||||
static ID intern_merge;
|
||||
|
||||
#define REQUIRE_OPEN_DB(_ctxt) \
|
||||
if(!_ctxt->net.vio) { \
|
||||
|
@ -529,4 +530,15 @@ void init_mysql2_client() {
|
|||
rb_define_private_method(cMysql2Client, "ssl_set", set_ssl_options, 5);
|
||||
rb_define_private_method(cMysql2Client, "init_connection", init_connection, 0);
|
||||
rb_define_private_method(cMysql2Client, "connect", rb_connect, 6);
|
||||
|
||||
intern_encoding_from_charset = rb_intern("encoding_from_charset");
|
||||
|
||||
sym_id = ID2SYM(rb_intern("id"));
|
||||
sym_version = ID2SYM(rb_intern("version"));
|
||||
sym_async = ID2SYM(rb_intern("async"));
|
||||
sym_symbolize_keys = ID2SYM(rb_intern("symbolize_keys"));
|
||||
sym_as = ID2SYM(rb_intern("as"));
|
||||
sym_array = ID2SYM(rb_intern("array"));
|
||||
|
||||
intern_merge = rb_intern("merge");
|
||||
}
|
|
@ -1,29 +1,12 @@
|
|||
#include <mysql2_ext.h>
|
||||
|
||||
VALUE mMysql2, cMysql2Error, intern_encoding_from_charset;
|
||||
ID sym_id, sym_version, sym_async, sym_symbolize_keys, sym_as,
|
||||
sym_array, sym_timezone, sym_utc, sym_local;
|
||||
ID intern_merge;
|
||||
VALUE mMysql2, cMysql2Error;
|
||||
|
||||
/* Ruby Extension initializer */
|
||||
void Init_mysql2() {
|
||||
mMysql2 = rb_define_module("Mysql2");
|
||||
cMysql2Error = rb_const_get(mMysql2, rb_intern("Error"));
|
||||
|
||||
intern_merge = rb_intern("merge");
|
||||
|
||||
sym_timezone = ID2SYM(rb_intern("timezone"));
|
||||
sym_utc = ID2SYM(rb_intern("utc"));
|
||||
sym_local = ID2SYM(rb_intern("local"));
|
||||
sym_array = ID2SYM(rb_intern("array"));
|
||||
sym_as = ID2SYM(rb_intern("as"));
|
||||
sym_id = ID2SYM(rb_intern("id"));
|
||||
sym_version = ID2SYM(rb_intern("version"));
|
||||
sym_async = ID2SYM(rb_intern("async"));
|
||||
sym_symbolize_keys = ID2SYM(rb_intern("symbolize_keys"));
|
||||
|
||||
intern_encoding_from_charset = rb_intern("encoding_from_charset");
|
||||
|
||||
init_mysql2_client();
|
||||
init_mysql2_result();
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
rb_encoding *binaryEncoding;
|
||||
#endif
|
||||
|
||||
ID intern_new, intern_utc, intern_local, intern_encoding_from_charset_code;
|
||||
|
||||
VALUE cMysql2Result;
|
||||
VALUE cBigDecimal, cDate, cDateTime;
|
||||
extern VALUE mMysql2, cMysql2Client, cMysql2Error, intern_encoding_from_charset;
|
||||
extern ID sym_symbolize_keys, sym_as, sym_array, sym_timezone, sym_local, sym_utc;
|
||||
extern ID intern_merge;
|
||||
extern VALUE mMysql2, cMysql2Client, cMysql2Error;
|
||||
static VALUE intern_encoding_from_charset;
|
||||
static ID intern_new, intern_utc, intern_local, intern_encoding_from_charset_code;
|
||||
static ID sym_symbolize_keys, sym_as, sym_array, sym_timezone, sym_local, sym_utc;
|
||||
static ID intern_merge;
|
||||
|
||||
static void rb_mysql_result_mark(void * wrapper) {
|
||||
mysql2_result_wrapper * w = wrapper;
|
||||
|
@ -367,10 +367,20 @@ void init_mysql2_result() {
|
|||
rb_define_method(cMysql2Result, "each", rb_mysql_result_each, -1);
|
||||
rb_define_method(cMysql2Result, "fields", rb_mysql_result_fetch_fields, 0);
|
||||
|
||||
intern_encoding_from_charset = rb_intern("encoding_from_charset");
|
||||
intern_encoding_from_charset_code = rb_intern("encoding_from_charset_code");
|
||||
|
||||
intern_new = rb_intern("new");
|
||||
intern_utc = rb_intern("utc");
|
||||
intern_local = rb_intern("local");
|
||||
intern_encoding_from_charset_code = rb_intern("encoding_from_charset_code");
|
||||
intern_merge = rb_intern("merge");
|
||||
|
||||
sym_symbolize_keys = ID2SYM(rb_intern("symbolize_keys"));
|
||||
sym_as = ID2SYM(rb_intern("as"));
|
||||
sym_array = ID2SYM(rb_intern("array"));
|
||||
sym_timezone = ID2SYM(rb_intern("timezone"));
|
||||
sym_local = ID2SYM(rb_intern("local"));
|
||||
sym_utc = ID2SYM(rb_intern("utc"));
|
||||
|
||||
#ifdef HAVE_RUBY_ENCODING_H
|
||||
binaryEncoding = rb_enc_find("binary");
|
||||
|
|
Loading…
Reference in New Issue