Skip to content

Commit 0b1d58d

Browse files
suketaclaude
andcommitted
refactor: fix pending_result.c naming to follow HACKING.md conventions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d258548 commit 0b1d58d

3 files changed

Lines changed: 28 additions & 28 deletions

File tree

ext/duckdb/duckdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Init_duckdb_native(void) {
4848
rbduckdb_init_column();
4949
rbduckdb_init_logical_type();
5050
rbduckdb_init_duckdb_prepared_statement();
51-
rbduckdb_init_duckdb_pending_result();
51+
rbduckdb_init_pending_result();
5252
rbduckdb_init_duckdb_blob();
5353
rbduckdb_init_appender();
5454
rbduckdb_init_duckdb_config();

ext/duckdb/pending_result.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ static VALUE cDuckDBPendingResult;
55
static void deallocate(void *ctx);
66
static VALUE allocate(VALUE klass);
77
static size_t memsize(const void *p);
8-
static VALUE duckdb_pending_result_initialize(int argc, VALUE *args, VALUE self);
9-
static VALUE duckdb_pending_result_execute_task(VALUE self);
10-
static VALUE duckdb_pending_result_execute_pending(VALUE self);
11-
static VALUE duckdb_pending_result_execution_finished_p(VALUE self);
12-
static VALUE duckdb_pending_result__state(VALUE self);
13-
static VALUE duckdb_pending_result__execute_check_state(VALUE self);
8+
static VALUE pending_result_initialize(int argc, VALUE *args, VALUE self);
9+
static VALUE pending_result_execute_task(VALUE self);
10+
static VALUE pending_result_execute_pending(VALUE self);
11+
static VALUE pending_result_execution_finished_p(VALUE self);
12+
static VALUE pending_result__state(VALUE self);
13+
static VALUE pending_result__execute_check_state(VALUE self);
1414

1515
static const rb_data_type_t pending_result_data_type = {
1616
"DuckDB/PendingResult",
@@ -35,7 +35,7 @@ static size_t memsize(const void *p) {
3535
return sizeof(rubyDuckDBPendingResult);
3636
}
3737

38-
static VALUE duckdb_pending_result_initialize(int argc, VALUE *argv, VALUE self) {
38+
static VALUE pending_result_initialize(int argc, VALUE *argv, VALUE self) {
3939
VALUE oDuckDBPreparedStatement;
4040
VALUE streaming_p = Qfalse;
4141
duckdb_state state;
@@ -49,7 +49,7 @@ static VALUE duckdb_pending_result_initialize(int argc, VALUE *argv, VALUE self)
4949
rb_raise(rb_eTypeError, "1st argument must be DuckDB::PreparedStatement");
5050
}
5151

52-
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
52+
rubyDuckDBPendingResult *ctx = rbduckdb_get_struct_pending_result(self);
5353
rubyDuckDBPreparedStatement *stmt = get_struct_prepared_statement(oDuckDBPreparedStatement);
5454

5555
state = duckdb_pending_prepared(stmt->prepared_statement, &(ctx->pending_result));
@@ -71,14 +71,14 @@ static VALUE duckdb_pending_result_initialize(int argc, VALUE *argv, VALUE self)
7171
* pending_result = conn.async_query("slow query")
7272
* pending_result.execute_task
7373
*/
74-
static VALUE duckdb_pending_result_execute_task(VALUE self) {
75-
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
74+
static VALUE pending_result_execute_task(VALUE self) {
75+
rubyDuckDBPendingResult *ctx = rbduckdb_get_struct_pending_result(self);
7676
ctx->state = duckdb_pending_execute_task(ctx->pending_result);
7777
return Qnil;
7878
}
7979

80-
static VALUE duckdb_pending_result_execution_finished_p(VALUE self) {
81-
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
80+
static VALUE pending_result_execution_finished_p(VALUE self) {
81+
rubyDuckDBPendingResult *ctx = rbduckdb_get_struct_pending_result(self);
8282
return duckdb_pending_execution_is_finished(ctx->state) ? Qtrue : Qfalse;
8383
}
8484

@@ -94,7 +94,7 @@ static VALUE duckdb_pending_result_execution_finished_p(VALUE self) {
9494
* pending_result.execute_task while pending_result.state != :ready
9595
* result = pending_result.execute_pending # => DuckDB::Result
9696
*/
97-
static VALUE duckdb_pending_result_execute_pending(VALUE self) {
97+
static VALUE pending_result_execute_pending(VALUE self) {
9898
rubyDuckDBPendingResult *ctx;
9999
rubyDuckDBResult *ctxr;
100100
VALUE result = rbduckdb_create_result();
@@ -108,34 +108,34 @@ static VALUE duckdb_pending_result_execute_pending(VALUE self) {
108108
}
109109

110110
/* :nodoc: */
111-
static VALUE duckdb_pending_result__state(VALUE self) {
112-
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
111+
static VALUE pending_result__state(VALUE self) {
112+
rubyDuckDBPendingResult *ctx = rbduckdb_get_struct_pending_result(self);
113113
return INT2FIX(ctx->state);
114114
}
115115

116116
/* :nodoc: */
117-
static VALUE duckdb_pending_result__execute_check_state(VALUE self) {
118-
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
117+
static VALUE pending_result__execute_check_state(VALUE self) {
118+
rubyDuckDBPendingResult *ctx = rbduckdb_get_struct_pending_result(self);
119119
return INT2FIX(duckdb_pending_execute_check_state(ctx->pending_result));
120120
}
121121

122-
rubyDuckDBPendingResult *get_struct_pending_result(VALUE obj) {
122+
rubyDuckDBPendingResult *rbduckdb_get_struct_pending_result(VALUE obj) {
123123
rubyDuckDBPendingResult *ctx;
124124
TypedData_Get_Struct(obj, rubyDuckDBPendingResult, &pending_result_data_type, ctx);
125125
return ctx;
126126
}
127127

128-
void rbduckdb_init_duckdb_pending_result(void) {
128+
void rbduckdb_init_pending_result(void) {
129129
#if 0
130130
VALUE mDuckDB = rb_define_module("DuckDB");
131131
#endif
132132
cDuckDBPendingResult = rb_define_class_under(mDuckDB, "PendingResult", rb_cObject);
133133
rb_define_alloc_func(cDuckDBPendingResult, allocate);
134134

135-
rb_define_method(cDuckDBPendingResult, "initialize", duckdb_pending_result_initialize, -1);
136-
rb_define_method(cDuckDBPendingResult, "execute_task", duckdb_pending_result_execute_task, 0);
137-
rb_define_method(cDuckDBPendingResult, "execute_pending", duckdb_pending_result_execute_pending, 0);
138-
rb_define_method(cDuckDBPendingResult, "execution_finished?", duckdb_pending_result_execution_finished_p, 0);
139-
rb_define_private_method(cDuckDBPendingResult, "_state", duckdb_pending_result__state, 0);
140-
rb_define_private_method(cDuckDBPendingResult, "_execute_check_state", duckdb_pending_result__execute_check_state, 0);
135+
rb_define_method(cDuckDBPendingResult, "initialize", pending_result_initialize, -1);
136+
rb_define_method(cDuckDBPendingResult, "execute_task", pending_result_execute_task, 0);
137+
rb_define_method(cDuckDBPendingResult, "execute_pending", pending_result_execute_pending, 0);
138+
rb_define_method(cDuckDBPendingResult, "execution_finished?", pending_result_execution_finished_p, 0);
139+
rb_define_private_method(cDuckDBPendingResult, "_state", pending_result__state, 0);
140+
rb_define_private_method(cDuckDBPendingResult, "_execute_check_state", pending_result__execute_check_state, 0);
141141
}

ext/duckdb/pending_result.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ struct _rubyDuckDBPendingResult {
88

99
typedef struct _rubyDuckDBPendingResult rubyDuckDBPendingResult;
1010

11-
rubyDuckDBPendingResult *get_struct_pending_result(VALUE obj);
12-
void rbduckdb_init_duckdb_pending_result(void);
11+
rubyDuckDBPendingResult *rbduckdb_get_struct_pending_result(VALUE obj);
12+
void rbduckdb_init_pending_result(void);
1313
#endif

0 commit comments

Comments
 (0)