This is an automated email from the git hooks/post-receive script. glondu pushed a commit to branch master in repository nss-passwords.
commit 00460ece0b61cdb56e8515b406eae0e32b28215b Author: Stephane Glondu <st...@glondu.net> Date: Fri Sep 5 15:51:22 2014 +0200 Move opening/closing of db to a function --- main.ml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.ml b/main.ml index a42d0d9..7dd3ba8 100644 --- a/main.ml +++ b/main.ml @@ -91,9 +91,6 @@ let () = nss_init !dir; at_exit nss_cleanup -let db = Sqlite3.db_open (FilePath.concat !dir "signons.sqlite") -let () = at_exit (fun () -> let r = Sqlite3.db_close db in assert (r = true)) - (** Decrypt passwords *) let check line = @@ -157,7 +154,7 @@ let process_row = function results := (hostname, username, password) :: !results | _ -> assert false -let exec query = +let exec db query = let buf = Buffer.create (2 * String.length query + 128) in Printf.bprintf buf "SELECT hostname, encryptedUsername, encryptedPassword FROM moz_logins WHERE hostname LIKE %a ESCAPE 'x';" @@ -165,9 +162,15 @@ let exec query = let r = Sqlite3.exec_not_null_no_headers ~cb:process_row db (Buffer.contents buf) in assert (r = Sqlite3.Rc.OK) +let exec_sqlite () = + let db = Sqlite3.db_open (FilePath.concat !dir "signons.sqlite") in + List.iter (exec db) !queries; + let r = Sqlite3.db_close db in + assert (r = true) + let () = try - List.iter exec !queries; + exec_sqlite (); let results = List.sort compare !results in let (a, b, c) = List.fold_left (fun (a, b, c) (x, y, z) -> -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/nss-passwords.git _______________________________________________ Pkg-ocaml-maint-commits mailing list Pkg-ocaml-maint-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits