Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct generated function name #245

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions duckdb-loadable-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(clippy::redundant_clone)]
use proc_macro2::Ident;
use proc_macro2::{Ident, Span};

use syn::{parse_macro_input, spanned::Spanned, Item};

Expand All @@ -13,6 +13,10 @@ pub fn duckdb_entrypoint(_attr: TokenStream, item: TokenStream) -> TokenStream {
match ast {
Item::Fn(mut func) => {
let c_entrypoint = func.sig.ident.clone();
let c_entrypoint_version = Ident::new(
c_entrypoint.to_string().replace("_init", "_version").as_str(),
Span::call_site(),
);

let original_funcname = func.sig.ident.to_string();
func.sig.ident = Ident::new(format!("_{}", original_funcname).as_str(), func.sig.ident.span());
Expand All @@ -35,7 +39,7 @@ pub fn duckdb_entrypoint(_attr: TokenStream, item: TokenStream) -> TokenStream {
///
/// Predefined function, don't need to change unless you are sure
#[no_mangle]
pub unsafe extern "C" fn libhello_ext_version() -> *const c_char {
pub unsafe extern "C" fn #c_entrypoint_version() -> *const c_char {
ffi::duckdb_library_version()
}

Expand Down
2 changes: 1 addition & 1 deletion src/vtab/excel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl VTab for ExcelVTab {
for data in rows.by_ref() {
// find the first row with no empty cell
let mut found = true;
for (_, cell) in data.iter().enumerate() {
for cell in data.iter() {
match cell {
DataType::Error(_) | DataType::Empty => {
found = false;
Expand Down
Loading