aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-08-03 21:13:23 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-08-14 21:24:27 +0900
commit03ef996e342678fe4fff7484929f6dbb4021305d (patch)
tree7c4546a89001daf864bf51d30f5187f02b98e349 /ext
parent3a2840e80d275895523a526ce56e4f6e7b8f9cc4 (diff)
downloadruby-openssl-03ef996e342678fe4fff7484929f6dbb4021305d.tar.gz
config: rename GetConfigPtr() to DupConfigPtr()
Make it follow the convention. Other Get*Ptr() functions return a pointer to OpenSSL object that the caller doesn't need to free. Indeed DupConfigPtr() is not the best name (OpenSSL::Config does not actually wrap a CONF object), but should be better than GetConfigPtr().
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_config.c11
-rw-r--r--ext/openssl/ossl_config.h1
-rw-r--r--ext/openssl/ossl_x509ext.c4
3 files changed, 8 insertions, 8 deletions
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index fd76415a..ebf6ae2a 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -26,13 +26,13 @@ VALUE eConfigError;
*/
/*
- * GetConfigPtr is a public C-level function for getting OpenSSL CONF struct
+ * DupConfigPtr is a public C-level function for getting OpenSSL CONF struct
* from an OpenSSL::Config(eConfig) instance. We decided to implement
* OpenSSL::Config in Ruby level but we need to pass native CONF struct for
* some OpenSSL features such as X509V3_EXT_*.
*/
CONF *
-GetConfigPtr(VALUE obj)
+DupConfigPtr(VALUE obj)
{
CONF *conf;
VALUE str;
@@ -50,9 +50,10 @@ GetConfigPtr(VALUE obj)
if(!NCONF_load_bio(conf, bio, &eline)){
BIO_free(bio);
NCONF_free(conf);
- if (eline <= 0) ossl_raise(eConfigError, "wrong config format");
- else ossl_raise(eConfigError, "error in line %d", eline);
- ossl_raise(eConfigError, NULL);
+ if (eline <= 0)
+ ossl_raise(eConfigError, "wrong config format");
+ else
+ ossl_raise(eConfigError, "error in line %d", eline);
}
BIO_free(bio);
diff --git a/ext/openssl/ossl_config.h b/ext/openssl/ossl_config.h
index 077e2f74..627d297b 100644
--- a/ext/openssl/ossl_config.h
+++ b/ext/openssl/ossl_config.h
@@ -13,7 +13,6 @@
extern VALUE cConfig;
extern VALUE eConfigError;
-CONF* GetConfigPtr(VALUE obj);
CONF* DupConfigPtr(VALUE obj);
void Init_ossl_config(void);
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c
index 021cc8ab..b4098859 100644
--- a/ext/openssl/ossl_x509ext.c
+++ b/ext/openssl/ossl_x509ext.c
@@ -196,7 +196,7 @@ ossl_x509extfactory_set_config(VALUE self, VALUE config)
GetX509ExtFactory(self, ctx);
rb_iv_set(self, "@config", config);
- conf = GetConfigPtr(config); /* NO DUP NEEDED */
+ conf = DupConfigPtr(config);
X509V3_set_nconf(ctx, conf);
return config;
@@ -257,7 +257,7 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
GetX509ExtFactory(self, ctx);
obj = NewX509Ext(cX509Ext);
rconf = rb_iv_get(self, "@config");
- conf = NIL_P(rconf) ? NULL : GetConfigPtr(rconf);
+ conf = NIL_P(rconf) ? NULL : DupConfigPtr(rconf);
ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr));
if (!ext){
ossl_raise(eX509ExtError, "%"PRIsVALUE" = %"PRIsVALUE, oid, valstr);