summaryrefslogtreecommitdiff
path: root/ext/socket/constants.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-16 16:55:33 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-16 16:55:33 +0000
commitd9bb9b32550027d44de9e47c90a9bd1b85f97593 (patch)
treec404231451f61da57b00916ef50401c582593c3d /ext/socket/constants.c
parent835fa875cc7e9c993c3f93aa6175df76aba4114c (diff)
* ext/socket/mkconstants.rb: generate rb_define_const directly for
rdoc. * ext/.document: add socket/constdefs.c. * ext/socket/constants.c (sock_define_const): removed. (sock_define_uconst): ditto. (rb_mSockConst): new static variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/constants.c')
-rw-r--r--ext/socket/constants.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/ext/socket/constants.c b/ext/socket/constants.c
index f0e2102..a8b0a37 100644
--- a/ext/socket/constants.c
+++ b/ext/socket/constants.c
@@ -10,13 +10,9 @@
#include "rubysocket.h"
-static void sock_define_const(const char *name, int value, VALUE mConst);
-static void sock_define_uconst(const char *name, unsigned int value, VALUE mConst);
-#define sock_define_const(name, value) sock_define_const(name, value, mConst)
-#define sock_define_uconst(name, value) sock_define_uconst(name, value, mConst)
+static VALUE rb_mSockConst;
+
#include "constdefs.c"
-#undef sock_define_const
-#undef sock_define_uconst
static int
constant_arg(VALUE arg, int (*str_to_int)(const char*, int, int*), const char *errmsg)
@@ -138,29 +134,13 @@ shutdown_how_arg(VALUE how)
return constant_arg(how, shutdown_how_to_int, "unknown shutdown argument");
}
-static void
-sock_define_const(const char *name, int value, VALUE mConst)
-{
- rb_define_const(rb_cSocket, name, INT2NUM(value));
- rb_define_const(mConst, name, INT2NUM(value));
-}
-
-static void
-sock_define_uconst(const char *name, unsigned int value, VALUE mConst)
-{
- rb_define_const(rb_cSocket, name, UINT2NUM(value));
- rb_define_const(mConst, name, UINT2NUM(value));
-}
-
/*
* Socket::Constants module
*/
void
Init_socket_constants(void)
{
- VALUE mConst;
-
/* constants */
- mConst = rb_define_module_under(rb_cSocket, "Constants");
- init_constants(mConst);
+ rb_mSockConst = rb_define_module_under(rb_cSocket, "Constants");
+ init_constants();
}