[tracker/binary-log-2: 12/45] Move local functions above public functions
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/binary-log-2: 12/45] Move local functions above public functions
- Date: Fri, 8 Jan 2010 11:26:16 +0000 (UTC)
commit 862b827f41151f7be4d38e55ba623626a5ae4adc
Author: Martyn Russell <martyn lanedo com>
Date: Mon Jan 4 14:37:01 2010 +0000
Move local functions above public functions
src/libtracker-db/tracker-db-journal.c | 122 ++++++++++++++++----------------
1 files changed, 61 insertions(+), 61 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index c48b8ad..bf3e09f 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -61,28 +61,39 @@ static gchar *cur_block = NULL;
static guint cur_entry_amount = 0;
static guint cur_pos = 0;
-gsize
-tracker_db_journal_get_size (void)
+static guint32
+read_uint32 (const gchar *data)
{
- return current_size;
+ return data[0] << 24 |
+ data[1] << 16 |
+ data[2] << 8 |
+ data[3];
}
-const gchar *
-tracker_db_journal_filename (void)
+static gint
+nearest_pow (gint num)
{
- if (!filename) {
- filename = g_build_filename (g_get_user_data_dir (),
- "tracker",
- "data",
- JOURNAL_FILENAME,
- NULL);
- }
+ gint n = 1;
+ while (n < num)
+ n <<= 1;
+ return n;
+}
- return filename;
+static void
+cur_block_maybe_expand (guint len)
+{
+ guint want_alloc = cur_block_len + len;
+
+ if (want_alloc > cur_block_alloc) {
+ want_alloc = nearest_pow (want_alloc);
+ want_alloc = MAX (want_alloc, MIN_BLOCK_SIZE);
+ cur_block = g_realloc (cur_block, want_alloc);
+ cur_block_alloc = want_alloc;
+ }
}
static void
-kill_cur_block (void)
+cur_block_kill (void)
{
cur_block_len = 0;
cur_pos = 0;
@@ -92,26 +103,46 @@ kill_cur_block (void)
cur_block = NULL;
}
-static gint
-nearest_pow (gint num)
+static void
+cur_setnum (gchar *dest,
+ guint *pos,
+ guint32 val)
{
- gint n = 1;
- while (n < num)
- n <<= 1;
- return n;
+ memset (dest + (*pos)++, val >> 24 & 0xff, 1);
+ memset (dest + (*pos)++, val >> 16 & 0xff, 1);
+ memset (dest + (*pos)++, val >> 8 & 0xff, 1);
+ memset (dest + (*pos)++, val >> 0 & 0xff, 1);
}
static void
-cur_block_maybe_expand (guint len)
+cur_setstr (gchar *dest,
+ guint *pos,
+ const gchar *str,
+ gsize len)
{
- guint want_alloc = cur_block_len + len;
+ memcpy (dest + *pos, str, len);
+ (*pos) += len;
+ memset (dest + (*pos)++, 0 & 0xff, 1);
+}
- if (want_alloc > cur_block_alloc) {
- want_alloc = nearest_pow (want_alloc);
- want_alloc = MAX (want_alloc, MIN_BLOCK_SIZE);
- cur_block = g_realloc (cur_block, want_alloc);
- cur_block_alloc = want_alloc;
+gsize
+tracker_db_journal_get_size (void)
+{
+ return current_size;
+}
+
+const gchar *
+tracker_db_journal_filename (void)
+{
+ if (!filename) {
+ filename = g_build_filename (g_get_user_data_dir (),
+ "tracker",
+ "data",
+ JOURNAL_FILENAME,
+ NULL);
}
+
+ return filename;
}
void
@@ -152,7 +183,7 @@ tracker_db_journal_open (const gchar *filen)
current_size += 8;
- kill_cur_block ();
+ cur_block_kill ();
}
}
@@ -173,28 +204,6 @@ tracker_db_journal_start_transaction (void)
cur_entry_amount = 0;
}
-static void
-cur_setnum (gchar *dest,
- guint *pos,
- guint32 val)
-{
- memset (dest + (*pos)++, val >> 24 & 0xff, 1);
- memset (dest + (*pos)++, val >> 16 & 0xff, 1);
- memset (dest + (*pos)++, val >> 8 & 0xff, 1);
- memset (dest + (*pos)++, val >> 0 & 0xff, 1);
-}
-
-static void
-cur_setstr (gchar *dest,
- guint *pos,
- const gchar *str,
- gsize len)
-{
- memcpy (dest + *pos, str, len);
- (*pos) += len;
- memset (dest + (*pos)++, 0 & 0xff, 1);
-}
-
void
tracker_db_journal_append_delete_statement (guint32 s_code,
guint32 p_code,
@@ -295,7 +304,7 @@ tracker_db_journal_append_resource (guint32 s_code,
void
tracker_db_journal_rollback_transaction (void)
{
- kill_cur_block ();
+ cur_block_kill ();
}
void
@@ -326,7 +335,7 @@ tracker_db_journal_commit_transaction (void)
current_size += cur_block_len;
- kill_cur_block ();
+ cur_block_kill ();
}
void
@@ -369,15 +378,6 @@ tracker_db_journal_reader_init (const gchar *filen)
journal_reader.current += 8;
}
-static
-guint32 read_uint32 (const gchar *data)
-{
- return data[0] << 24 |
- data[1] << 16 |
- data[2] << 8 |
- data[3];
-}
-
gboolean
tracker_db_journal_next (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]