diff --git a/ext/bsdcontrol.rb/bsdcontrol.c b/ext/bsdcontrol.rb/bsdcontrol.c index dcf03cb..ae24e31 100644 --- a/ext/bsdcontrol.rb/bsdcontrol.c +++ b/ext/bsdcontrol.rb/bsdcontrol.c @@ -41,14 +41,6 @@ bsdcontrol_open(VALUE path) return fd; } -hbsdctrl_ctx_t * -bsdcontrol_unwrap(VALUE rbcontext) -{ - hbsdctrl_ctx_t *ctx; - Data_Get_Struct(rbcontext, hbsdctrl_ctx_t, ctx); - return ctx; -} - hbsdctrl_feature_t * bsdcontrol_find_feature(hbsdctrl_ctx_t *ctx, VALUE rbfeature) { diff --git a/ext/bsdcontrol.rb/bsdcontrol.h b/ext/bsdcontrol.rb/bsdcontrol.h index 19cc7c6..264d19d 100644 --- a/ext/bsdcontrol.rb/bsdcontrol.h +++ b/ext/bsdcontrol.rb/bsdcontrol.h @@ -3,5 +3,4 @@ #include int bsdcontrol_open(VALUE); -hbsdctrl_ctx_t* bsdcontrol_unwrap(VALUE); hbsdctrl_feature_t* bsdcontrol_find_feature(hbsdctrl_ctx_t*, VALUE); diff --git a/ext/bsdcontrol.rb/context.c b/ext/bsdcontrol.rb/context.c index 1ba565f..495279f 100644 --- a/ext/bsdcontrol.rb/context.c +++ b/ext/bsdcontrol.rb/context.c @@ -19,6 +19,14 @@ bsdcontrol_context_alloc(VALUE klass) return Data_Wrap_Struct(klass, NULL, bsdcontrol_context_free, ctx); } +hbsdctrl_ctx_t * +bsdcontrol_context_unwrap(VALUE rbcontext) +{ + hbsdctrl_ctx_t *ctx; + Data_Get_Struct(rbcontext, hbsdctrl_ctx_t, ctx); + return ctx; +} + static void bsdcontrol_context_free(hbsdctrl_ctx_t *ctx) { @@ -39,7 +47,7 @@ bsdcontrol_context_available_features(VALUE self) feature = 0, features = rb_ary_new(); hbsdctrl_ctx_t *ctx; char **name; - ctx = bsdcontrol_unwrap(self); + ctx = bsdcontrol_context_unwrap(self); name = hbsdctrl_ctx_all_feature_names(ctx); while (*name != NULL) { @@ -59,6 +67,6 @@ VALUE bsdcontrol_context_library_version(VALUE self) { hbsdctrl_ctx_t *ctx; - ctx = bsdcontrol_unwrap(self); + ctx = bsdcontrol_context_unwrap(self); return ULONG2NUM(ctx->hc_version); } diff --git a/ext/bsdcontrol.rb/context.h b/ext/bsdcontrol.rb/context.h index 2ecbbdc..5da922c 100644 --- a/ext/bsdcontrol.rb/context.h +++ b/ext/bsdcontrol.rb/context.h @@ -4,3 +4,4 @@ VALUE bsdcontrol_context_alloc(VALUE); VALUE bsdcontrol_context_library_version(VALUE); VALUE bsdcontrol_context_available_features(VALUE); +hbsdctrl_ctx_t* bsdcontrol_context_unwrap(VALUE); diff --git a/ext/bsdcontrol.rb/feature.c b/ext/bsdcontrol.rb/feature.c index 5af05b3..1713446 100644 --- a/ext/bsdcontrol.rb/feature.c +++ b/ext/bsdcontrol.rb/feature.c @@ -19,7 +19,7 @@ bsdcontrol_feature_status(VALUE self, VALUE path) hbsdctrl_ctx_t *ctx; rbcontext = rb_funcall(self, rb_intern("context"), 0); fd = bsdcontrol_open(path); - ctx = bsdcontrol_unwrap(rbcontext); + ctx = bsdcontrol_context_unwrap(rbcontext); feature = bsdcontrol_find_feature(ctx, self); errno = 0; if (feature->hf_get(ctx, feature, &fd, &state) == RES_FAIL) @@ -50,7 +50,7 @@ bsdcontrol_feature_set(VALUE self, VALUE path, VALUE rbstate) int state; rbcontext = rb_funcall(self, rb_intern("context"), 0); fd = bsdcontrol_open(path); - ctx = bsdcontrol_unwrap(rbcontext); + ctx = bsdcontrol_context_unwrap(rbcontext); feature = bsdcontrol_find_feature(ctx, self); state = NUM2INT(rbstate); errno = 0; @@ -79,7 +79,7 @@ bsdcontrol_feature_sysdef(VALUE self, VALUE path) hbsdctrl_ctx_t *ctx; rbcontext = rb_funcall(self, rb_intern("context"), 0); fd = bsdcontrol_open(path); - ctx = bsdcontrol_unwrap(rbcontext); + ctx = bsdcontrol_context_unwrap(rbcontext); feature = bsdcontrol_find_feature(ctx, self); errno = 0; if (feature->hf_unapply(ctx, feature, &fd, NULL) == RES_FAIL)