From a4174ee888c622d1a1a49a9acd6f7f4504b11806 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Wed, 24 Mar 2010 11:04:22 +0800 Subject: [PATCH] Add some log message --- src/Database.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Database.cc b/src/Database.cc index 7204606..d0070c2 100644 --- a/src/Database.cc +++ b/src/Database.cc @@ -60,19 +60,20 @@ Database::init (void) PKGDATADIR"/db/open-phrase.db", PKGDATADIR"/db/android.db", "main.db", - NULL }; guint i; - for (i = 0; maindb[i] != NULL; i++) { + for (i = 0; i < G_N_ELEMENTS (maindb); i++) { if (!g_file_test(maindb[i], G_FILE_TEST_IS_REGULAR)) continue; if (sqlite3_open_v2 (maindb[i], &m_db, - SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) == SQLITE_OK) + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) == SQLITE_OK) { + g_message ("Use database %s", maindb[i]); break; + } } - if (maindb[i] == NULL) { + if (i == G_N_ELEMENTS (maindb)) { g_warning ("can not open main database"); goto _failed; } -- 2.7.4