diff --git a/CHANGELOG.md b/CHANGELOG.md index 33dd565..0a77ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ Also check the changes in springql-core: ## [Unreleased] +## [v0.15.0+2] - 2022-06-30 + +### Fixed + +- Fix name conflict of `errno` in a `spring_last_err`'s argument with `errno.h` ([#54](https://github.com/SpringQL/SpringQL-client-c/pull/54)) + ## [v0.15.0] - 2022-06-29 ### Added @@ -102,8 +108,9 @@ Depends on springql-core v0.7.1. [Semantic Versioning]: https://semver.org/ -[Unreleased]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.15.0...HEAD +[Unreleased]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.15.0+2...HEAD [Released]: https://github.com/SpringQL/SpringQL-client-c/releases +[v0.15.0+2]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.15.0...v0.15.0+2 [v0.15.0]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.14.0...v0.15.0 [v0.14.0]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.13.0+4...v0.14.0 [v0.13.0+4]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.13.0+3...v0.13.0+4 diff --git a/Cargo.lock b/Cargo.lock index 9bb2260..a0b00c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1044,7 +1044,7 @@ dependencies = [ [[package]] name = "springql-client-c" -version = "0.15.0" +version = "0.15.0+2" dependencies = [ "cbindgen", "log", diff --git a/Cargo.toml b/Cargo.toml index 96f60a8..5026b34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "springql-client-c" -version = "0.15.0" +version = "0.15.0+2" authors = ["Sho Nakatani "] license = "MIT OR Apache-2.0" diff --git a/c_example/doc_app1/doc_app1.c b/c_example/doc_app1/doc_app1.c index 577b3ba..6a2705c 100644 --- a/c_example/doc_app1/doc_app1.c +++ b/c_example/doc_app1/doc_app1.c @@ -13,10 +13,10 @@ void abort_with_report() { - SpringErrno errno; + SpringErrno errno_; char errmsg[1024]; - spring_last_err(&errno, errmsg, 1024); - fprintf(stderr, "Error occurred (%d): %s", errno, errmsg); + spring_last_err(&errno_, errmsg, 1024); + fprintf(stderr, "Error occurred (%d): %s", errno_, errmsg); abort(); } diff --git a/c_example/doc_app2/doc_app2.c b/c_example/doc_app2/doc_app2.c index 50e32b5..1d11e76 100644 --- a/c_example/doc_app2/doc_app2.c +++ b/c_example/doc_app2/doc_app2.c @@ -19,10 +19,10 @@ void abort_with_report() { - SpringErrno errno; + SpringErrno errno_; char errmsg[1024]; - spring_last_err(&errno, errmsg, 1024); - fprintf(stderr, "Error occurred (%d): %s", errno, errmsg); + spring_last_err(&errno_, errmsg, 1024); + fprintf(stderr, "Error occurred (%d): %s", errno_, errmsg); abort(); } diff --git a/c_example/trade_projection/trade_projection.c b/c_example/trade_projection/trade_projection.c index 3fe57fb..a3b6dd9 100644 --- a/c_example/trade_projection/trade_projection.c +++ b/c_example/trade_projection/trade_projection.c @@ -12,10 +12,10 @@ void abort_with_report() { - SpringErrno errno; + SpringErrno errno_; char errmsg[1024]; - spring_last_err(&errno, errmsg, 1024); - fprintf(stderr, "Error occurred (%d): %s", errno, errmsg); + spring_last_err(&errno_, errmsg, 1024); + fprintf(stderr, "Error occurred (%d): %s", errno_, errmsg); abort(); } diff --git a/springql.h b/springql.h index 0ca8ce5..8762090 100644 --- a/springql.h +++ b/springql.h @@ -415,7 +415,7 @@ enum SpringErrno spring_column_bool(const SpringSinkRow *row, uint16_t i_col, bo enum SpringErrno spring_column_float(const SpringSinkRow *row, uint16_t i_col, float *out); /** - * Write the most recent error number into `errno` and message into a caller-provided buffer as a UTF-8 + * Write the most recent error number into `errno_` and message into a caller-provided buffer as a UTF-8 * string, returning the number of bytes written. * * # Note @@ -433,7 +433,7 @@ enum SpringErrno spring_column_float(const SpringSinkRow *row, uint16_t i_col, f * - `> 0`: the length of the recent error message. * - `< 0`: SpringErrno */ -int spring_last_err(enum SpringErrno *errno, +int spring_last_err(enum SpringErrno *errno_, char *errmsg, int errmsg_len); diff --git a/src/spring_last_err.rs b/src/spring_last_err.rs index 9784df6..43b5b07 100644 --- a/src/spring_last_err.rs +++ b/src/spring_last_err.rs @@ -72,7 +72,7 @@ pub(super) fn update_last_error(err: LastError) { }); } -/// Write the most recent error number into `errno` and message into a caller-provided buffer as a UTF-8 +/// Write the most recent error number into `errno_` and message into a caller-provided buffer as a UTF-8 /// string, returning the number of bytes written. /// /// # Note @@ -91,7 +91,7 @@ pub(super) fn update_last_error(err: LastError) { /// - `< 0`: SpringErrno #[no_mangle] pub unsafe extern "C" fn spring_last_err( - errno: *mut SpringErrno, + errno_: *mut SpringErrno, errmsg: *mut c_char, errmsg_len: c_int, ) -> c_int { @@ -103,12 +103,12 @@ pub unsafe extern "C" fn spring_last_err( let last_error = match take_last_error() { Some(err) => err, None => { - *errno = SpringErrno::Ok; + *errno_ = SpringErrno::Ok; return SpringErrno::Ok as c_int; } }; - *errno = SpringErrno::from(&last_error); + *errno_ = SpringErrno::from(&last_error); let error_message = last_error.to_string(); strcpy(&error_message, errmsg, errmsg_len)