ext/duckdb/connection.c in duckdb-0.2.9.0 vs ext/duckdb/connection.c in duckdb-0.3.1.0

- old
+ new

@@ -1,25 +1,28 @@ #include "ruby-duckdb.h" VALUE cDuckDBConnection; -static void deallocate(void *ctx) -{ +static void deallocate(void *ctx); +static VALUE allocate(VALUE klass); +static VALUE duckdb_connection_disconnect(VALUE self); +static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase); +static VALUE duckdb_connection_query_sql(VALUE self, VALUE str); + +static void deallocate(void *ctx) { rubyDuckDBConnection *p = (rubyDuckDBConnection *)ctx; duckdb_disconnect(&(p->con)); xfree(p); } -static VALUE allocate(VALUE klass) -{ +static VALUE allocate(VALUE klass) { rubyDuckDBConnection *ctx = xcalloc((size_t)1, sizeof(rubyDuckDBConnection)); return Data_Wrap_Struct(klass, NULL, deallocate, ctx); } -VALUE create_connection(VALUE oDuckDBDatabase) -{ +VALUE create_connection(VALUE oDuckDBDatabase) { rubyDuckDB *ctxdb; rubyDuckDBConnection *ctxcon; VALUE obj; Data_Get_Struct(oDuckDBDatabase, rubyDuckDB, ctxdb); @@ -33,22 +36,20 @@ // rb_ivar_set(obj, rb_intern("database"), oDuckDBDatabase); return obj; } -static VALUE duckdb_connection_disconnect(VALUE self) -{ +static VALUE duckdb_connection_disconnect(VALUE self) { rubyDuckDBConnection *ctx; Data_Get_Struct(self, rubyDuckDBConnection, ctx); duckdb_disconnect(&(ctx->con)); return self; } -static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase) -{ +static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase) { rubyDuckDBConnection *ctx; rubyDuckDB *ctxdb; if (!rb_obj_is_kind_of(oDuckDBDatabase, cDuckDBDatabase)) { rb_raise(rb_eTypeError, "The first argument must be DuckDB::Database object."); @@ -61,11 +62,10 @@ } return self; } -static VALUE duckdb_connection_query_sql(VALUE self, VALUE str) -{ +static VALUE duckdb_connection_query_sql(VALUE self, VALUE str) { rubyDuckDBConnection *ctx; rubyDuckDBResult *ctxr; VALUE result = create_result();