[cleanup] make all C symbols static

Other than the Init_$extension() function, the only reason
to have public symbols is for large C extensions that need
to span multiple .c files and we're not one of them.
This commit is contained in:
Eric Wong 2010-05-05 15:35:49 -07:00
parent 081eea9a9c
commit f7a6b49cbd
2 changed files with 12 additions and 12 deletions

View File

@ -175,7 +175,7 @@ static VALUE rb_mysql_client_init(RB_MYSQL_UNUSED int argc, RB_MYSQL_UNUSED VALU
return self;
}
void rb_mysql_client_free(void * client) {
static void rb_mysql_client_free(void * client) {
MYSQL * c = client;
if (c) {
/*
@ -366,7 +366,7 @@ static VALUE rb_mysql_result_to_obj(MYSQL_RES * r) {
return obj;
}
void rb_mysql_result_free(void * wrapper) {
static void rb_mysql_result_free(void * wrapper) {
mysql2_result_wrapper * w = wrapper;
if (w && w->resultFreed != 1) {
/* FIXME: this may call flush_use_result, which can hit the socket */
@ -375,7 +375,7 @@ void rb_mysql_result_free(void * wrapper) {
}
}
void rb_mysql_result_mark(void * wrapper) {
static void rb_mysql_result_mark(void * wrapper) {
mysql2_result_wrapper * w = wrapper;
if (w) {
rb_gc_mark(w->fields);
@ -649,4 +649,4 @@ void Init_mysql2_ext() {
utf8Encoding = rb_enc_find_index("UTF-8");
binaryEncoding = rb_enc_find_index("binary");
#endif
}
}

View File

@ -14,7 +14,7 @@
#ifdef HAVE_RUBY_ENCODING_H
#include <ruby/encoding.h>
int utf8Encoding, binaryEncoding;
static int utf8Encoding, binaryEncoding;
#endif
#if defined(__GNUC__) && (__GNUC__ >= 3)
@ -24,10 +24,10 @@ int utf8Encoding, binaryEncoding;
#endif
static VALUE cBigDecimal, cDate, cDateTime;
ID intern_new, intern_local;
static ID intern_new, intern_local;
/* Mysql2::Error */
VALUE cMysql2Error;
static VALUE cMysql2Error;
/* Mysql2::Client */
#define GetMysql2Client(obj, sval) (sval = (MYSQL*)DATA_PTR(obj));
@ -45,7 +45,7 @@ static VALUE rb_mysql_client_socket(VALUE self);
static VALUE rb_mysql_client_async_result(VALUE self);
static VALUE rb_mysql_client_last_id(VALUE self);
static VALUE rb_mysql_client_affected_rows(VALUE self);
void rb_mysql_client_free(void * client);
static void rb_mysql_client_free(void * client);
/* Mysql2::Result */
typedef struct {
@ -58,12 +58,12 @@ typedef struct {
MYSQL_RES *result;
} mysql2_result_wrapper;
#define GetMysql2Result(obj, sval) (sval = (mysql2_result_wrapper*)DATA_PTR(obj));
VALUE cMysql2Result;
static VALUE cMysql2Result;
static VALUE rb_mysql_result_to_obj(MYSQL_RES * res);
static VALUE rb_mysql_result_fetch_row(int argc, VALUE * argv, VALUE self);
static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self);
void rb_mysql_result_free(void * wrapper);
void rb_mysql_result_mark(void * wrapper);
static void rb_mysql_result_free(void * wrapper);
static void rb_mysql_result_mark(void * wrapper);
/*
* used to pass all arguments to mysql_real_connect while inside
@ -113,4 +113,4 @@ rb_thread_blocking_region(
return rv;
}
#endif /* ! HAVE_RB_THREAD_BLOCKING_REGION */
#endif /* ! HAVE_RB_THREAD_BLOCKING_REGION */