diff options
-rw-r--r-- | CHANGES.md | 14 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | debian/control | 7 | ||||
-rwxr-xr-x | debian/rules | 3 | ||||
-rw-r--r-- | dune-project | 5 | ||||
-rw-r--r-- | sqlite3.opam | 5 | ||||
-rw-r--r-- | src/dune | 5 | ||||
-rw-r--r-- | src/sqlite3.mli | 6 | ||||
-rw-r--r-- | src/sqlite3_stubs.c | 43 |
9 files changed, 52 insertions, 44 deletions
@@ -1,3 +1,17 @@ +### 5.0.2 (2020-07-30) + + * Added missing `dune-configurator` dependency. + + * Removed redundant build dependencies. + + * Use `caml_alloc_initialized_string` wherever possible. + + * Fixed documentation typos and wording. + + * Added support for const char strings in stubs due to stricter handling + in newer OCaml runtimes. This eliminates C-compiler warnings. + + ### 5.0.1 (2019-12-01) * Added missing :with-test declaration in Dune project file. diff --git a/debian/changelog b/debian/changelog index 6d5219c..5bebe2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ocaml-sqlite3 (5.0.2-1) unstable; urgency=medium + + * New upstream release + * Bump debhelper compat level to 13 + * Bump Standards-Version to 4.5.0 + + -- Stéphane Glondu <glondu@debian.org> Thu, 20 Aug 2020 09:06:05 +0200 + ocaml-sqlite3 (5.0.1-1) unstable; urgency=medium * New upstream release diff --git a/debian/control b/debian/control index fc95b27..dec96d6 100644 --- a/debian/control +++ b/debian/control @@ -4,16 +4,15 @@ Maintainer: Debian OCaml Maintainers <debian-ocaml-maint@lists.debian.org> Uploaders: Stéphane Glondu <glondu@debian.org> Build-Depends: - debhelper-compat (= 12), + debhelper-compat (= 13), pkg-config, ocaml-nox (>= 4.01), libsqlite3-dev (>= 3.3.9), ocaml-dune, libdune-ocaml-dev, ocaml-findlib (>= 1.4), - ocamlbuild, - dh-ocaml (>= 0.9) -Standards-Version: 4.4.1 + dh-ocaml +Standards-Version: 4.5.0 Rules-Requires-Root: no Section: ocaml Homepage: http://mmottl.github.io/sqlite3-ocaml diff --git a/debian/rules b/debian/rules index 853a495..3f77614 100755 --- a/debian/rules +++ b/debian/rules @@ -19,6 +19,3 @@ override_dh_auto_test: override_dh_auto_install: dune install --destdir=$(DESTDIR) --prefix=/usr --libdir=..$(OCAML_STDLIB_DIR) rm -f $(DESTDIR)/usr/doc/sqlite3/LICENSE.md - -override_dh_missing: - dh_missing --fail-missing diff --git a/dune-project b/dune-project index 4f808a3..5958090 100644 --- a/dune-project +++ b/dune-project @@ -1,6 +1,6 @@ (lang dune 1.10) (name sqlite3) -(version 5.0.1) +(version 5.0.2) (generate_opam_files true) @@ -26,9 +26,8 @@ database engine with outstanding performance for many use cases.") (depends (ocaml (>= 4.05)) (dune (>= 1.11)) + dune-configurator (conf-sqlite3 :build) - (base :build) - (stdio :build) (ppx_inline_test :with-test) ) (tags (clib:sqlite3 clib:pthread)) diff --git a/sqlite3.opam b/sqlite3.opam index 0d82086..754f6cf 100644 --- a/sqlite3.opam +++ b/sqlite3.opam @@ -1,4 +1,4 @@ -version: "5.0.1" +version: "5.0.2" # This file is generated by dune, edit dune-project instead opam-version: "2.0" build: [ @@ -25,8 +25,7 @@ database engine with outstanding performance for many use cases.""" depends: [ "ocaml" {>= "4.05"} "dune" {>= "1.11"} + "dune-configurator" "conf-sqlite3" {build} - "base" {build} - "stdio" {build} "ppx_inline_test" {with-test} ]
\ No newline at end of file @@ -1,10 +1,7 @@ (library (public_name sqlite3) (c_names sqlite3_stubs) - (c_flags - (:standard) (:include c_flags.sexp) -O2 -fPIC -DPIC - -Wno-keyword-macro - ) + (c_flags (:standard) (:include c_flags.sexp) -O2 -fPIC -DPIC) (c_library_flags (:include c_library_flags.sexp) -lpthread) ) diff --git a/src/sqlite3.mli b/src/sqlite3.mli index 520cbc1..e0adc4e 100644 --- a/src/sqlite3.mli +++ b/src/sqlite3.mli @@ -373,9 +373,9 @@ val exec : db -> ?cb : (row -> headers -> unit) -> string -> Rc.t (** [exec db ?cb sql] performs SQL-operation [sql] on database [db]. If the operation contains query statements, then the callback function [cb] will be called for each matching row. The first parameter of - the callback is the contents of the row, the second paramater are the - headers of the columns associated with the row. Exceptions raised - within the callback will abort the execution and escape {!exec}. + the callback contains the contents of the row, the second parameter + contains the headers of the columns associated with the row. Exceptions + raised within the callback will abort the execution and escape {!exec}. @return the return code of the operation. diff --git a/src/sqlite3_stubs.c b/src/sqlite3_stubs.c index 8d05eaa..7e5415a 100644 --- a/src/sqlite3_stubs.c +++ b/src/sqlite3_stubs.c @@ -40,16 +40,11 @@ #include <sqlite3.h> #if __GNUC__ >= 3 -# define inline inline __attribute__ ((always_inline)) # if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly) && !__APPLE__ -# define __unused __attribute__ ((unused)) +# define __unused __attribute__ ((unused)) # endif #else # define __unused -# ifdef inline -# undef inline -# endif -# define inline #endif #if SQLITE_VERSION_NUMBER >= 3003007 && !SQLITE3_DISABLE_LOADABLE_EXTENSIONS @@ -260,14 +255,14 @@ static void raise_sqlite3_misuse_db(db_wrap *dbw, const char *fmt, ...) raise_sqlite3_Error("%s", buf); } -static inline void raise_sqlite3_current(sqlite3 *db, char *loc) +static inline void raise_sqlite3_current(sqlite3 *db, const char *loc) { const char *what = sqlite3_errmsg(db); if (!what) what = "<No error>"; raise_sqlite3_Error("Sqlite3.%s: %s", loc, what); } -static inline void check_db(db_wrap *dbw, char *loc) +static inline void check_db(db_wrap *dbw, const char *loc) { if (!dbw->db) raise_sqlite3_misuse_db(dbw, "Sqlite3.%s called with closed database", loc); @@ -888,7 +883,7 @@ static struct custom_operations stmt_wrap_ops = { }; static inline value prepare_it( - db_wrap *dbw, const char *sql, int sql_len, char *loc) + db_wrap *dbw, const char *sql, int sql_len, const char *loc) { int rc; stmt_wrap *stmtw = caml_stat_alloc(sizeof(stmt_wrap)); @@ -938,7 +933,7 @@ CAMLprim value caml_sqlite3_stmt_reset(value v_stmt) CAMLprim value caml_sqlite3_prepare(value v_db, value v_sql) { CAMLparam1(v_db); - char *loc = "prepare", *sql = String_val(v_sql); + const char *loc = "prepare", *sql = String_val(v_sql); db_wrap *dbw = Sqlite3_val(v_db); check_db(dbw, loc); CAMLreturn(prepare_it(dbw, sql, caml_string_length(v_sql), loc)); @@ -1010,7 +1005,7 @@ CAMLprim value caml_sqlite3_bind_parameter_name_bc(value v_stmt, value v_pos) CAMLprim intnat caml_sqlite3_bind_parameter_index(value v_stmt, value v_name) { sqlite3_stmt *stmt = safe_get_stmtw("bind_parameter_index", v_stmt)->stmt; - char *parm_name = String_val(v_name); + const char *parm_name = String_val(v_name); int index = sqlite3_bind_parameter_index(stmt, parm_name); if (!index) caml_raise_not_found(); return index; @@ -1217,8 +1212,7 @@ CAMLprim value caml_sqlite3_column_blob(value v_stmt, intnat pos) sqlite3_stmt *stmt = safe_get_stmtw("column_blob", v_stmt)->stmt; range_check(pos, sqlite3_column_count(stmt)); len = sqlite3_column_bytes(stmt, pos); - v_str = caml_alloc_string(len); - memcpy(String_val(v_str), sqlite3_column_blob(stmt, pos), len); + v_str = caml_alloc_initialized_string(len, sqlite3_column_blob(stmt, pos)); CAMLreturn(v_str); } @@ -1279,8 +1273,8 @@ CAMLprim value caml_sqlite3_column_text(value v_stmt, intnat pos) sqlite3_stmt *stmt = safe_get_stmtw("column_text", v_stmt)->stmt; range_check(pos, sqlite3_column_count(stmt)); len = sqlite3_column_bytes(stmt, pos); - v_str = caml_alloc_string(len); - memcpy(String_val(v_str), sqlite3_column_text(stmt, pos), len); + v_str = + caml_alloc_initialized_string(len, (char *) sqlite3_column_text(stmt, pos)); CAMLreturn(v_str); } @@ -1312,15 +1306,16 @@ CAMLprim value caml_sqlite3_column(value v_stmt, intnat pos) break; case SQLITE3_TEXT : len = sqlite3_column_bytes(stmt, pos); - v_tmp = caml_alloc_string(len); - memcpy(String_val(v_tmp), (char *) sqlite3_column_text(stmt, pos), len); + v_tmp = + caml_alloc_initialized_string( + len, (char *) sqlite3_column_text(stmt, pos)); v_res = caml_alloc_small(1, 2); Field(v_res, 0) = v_tmp; break; case SQLITE_BLOB : len = sqlite3_column_bytes(stmt, pos); - v_tmp = caml_alloc_string(len); - memcpy(String_val(v_tmp), (char *) sqlite3_column_blob(stmt, pos), len); + v_tmp = + caml_alloc_initialized_string(len, sqlite3_column_blob(stmt, pos)); v_res = caml_alloc_small(1, 3); Field(v_res, 0) = v_tmp; break; @@ -1380,15 +1375,15 @@ static inline value caml_sqlite3_wrap_values(int argc, sqlite3_value **args) break; case SQLITE3_TEXT : len = sqlite3_value_bytes(arg); - v_tmp = caml_alloc_string(len); - memcpy(String_val(v_tmp), (char *) sqlite3_value_text(arg), len); + v_tmp = + caml_alloc_initialized_string( + len, (char *) sqlite3_value_text(arg)); v_res = caml_alloc_small(1, 2); Field(v_res, 0) = v_tmp; break; case SQLITE_BLOB : len = sqlite3_value_bytes(arg); - v_tmp = caml_alloc_string(len); - memcpy(String_val(v_tmp), (char *) sqlite3_value_blob(arg), len); + v_tmp = caml_alloc_initialized_string(len, sqlite3_value_blob(arg)); v_res = caml_alloc_small(1, 3); Field(v_res, 0) = v_tmp; break; @@ -1497,7 +1492,7 @@ MK_USER_FUNCTION_VALUE_FINAL(final, Field(data->v_fun, 5), static inline void unregister_user_function(db_wrap *db_data, value v_name) { user_function *prev = NULL, *link = db_data->user_functions; - char *name = String_val(v_name); + const char *name = String_val(v_name); while (link != NULL) { if (strcmp(String_val(Field(link->v_fun, 0)), name) == 0) { |