[tracker/binary-log-2: 12/42] Use typedef enum for journal data formats
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/binary-log-2: 12/42] Use typedef enum for journal data formats
- Date: Mon, 11 Jan 2010 18:30:27 +0000 (UTC)
commit c85beaff6b76c4b39d6a4da597a7002a99c8e4a3
Author: Martyn Russell <martyn lanedo com>
Date: Tue Jan 5 17:18:37 2010 +0000
Use typedef enum for journal data formats
src/libtracker-db/tracker-db-journal.c | 48 ++++++++++++++++----------------
1 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index 5bb775d..0fbf5a2 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -49,11 +49,11 @@
* `--- operation type (0 = insert, 1 = delete)
*/
-enum {
+typedef enum {
DATA_FORMAT_RESOURCE_INSERT = 1 << 0,
DATA_FORMAT_OBJECT_ID = 1 << 1,
DATA_FORMAT_OPERATION_DELETE = 1 << 2
-};
+} DataFormat;
static struct {
gchar *filename;
@@ -322,19 +322,19 @@ tracker_db_journal_append_delete_statement (guint32 s_id,
const gchar *object)
{
gint o_len;
- gchar data_format;
+ DataFormat df;
gint size;
g_return_val_if_fail (writer.journal > 0, FALSE);
o_len = strlen (object);
- data_format = DATA_FORMAT_OPERATION_DELETE;
+ df = DATA_FORMAT_OPERATION_DELETE;
size = (sizeof (guint32) * 3) + o_len + 1;
cur_block_maybe_expand (size);
- cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
+ cur_setnum (writer.cur_block, &writer.cur_pos, df);
cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
cur_setstr (writer.cur_block, &writer.cur_pos, object, o_len);
@@ -350,17 +350,17 @@ tracker_db_journal_append_delete_statement_id (guint32 s_id,
guint32 p_id,
guint32 o_id)
{
- gchar data_format;
+ DataFormat df;
gint size;
g_return_val_if_fail (writer.journal > 0, FALSE);
- data_format = DATA_FORMAT_OPERATION_DELETE | DATA_FORMAT_OBJECT_ID;
+ df = DATA_FORMAT_OPERATION_DELETE | DATA_FORMAT_OBJECT_ID;
size = sizeof (guint32) * 4;
cur_block_maybe_expand (size);
- cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
+ cur_setnum (writer.cur_block, &writer.cur_pos, df);
cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
cur_setnum (writer.cur_block, &writer.cur_pos, o_id);
@@ -377,18 +377,18 @@ tracker_db_journal_append_insert_statement (guint32 s_id,
const gchar *object)
{
gint o_len;
- gchar data_format;
+ DataFormat df;
gint size;
g_return_val_if_fail (writer.journal > 0, FALSE);
o_len = strlen (object);
- data_format = 0x00;
+ df = 0x00;
size = (sizeof (guint32) * 3) + o_len + 1;
cur_block_maybe_expand (size);
- cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
+ cur_setnum (writer.cur_block, &writer.cur_pos, df);
cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
cur_setstr (writer.cur_block, &writer.cur_pos, object, o_len);
@@ -404,17 +404,17 @@ tracker_db_journal_append_insert_statement_id (guint32 s_id,
guint32 p_id,
guint32 o_id)
{
- gchar data_format;
+ DataFormat df;
gint size;
g_return_val_if_fail (writer.journal > 0, FALSE);
- data_format = DATA_FORMAT_OBJECT_ID;
+ df = DATA_FORMAT_OBJECT_ID;
size = sizeof (guint32) * 4;
cur_block_maybe_expand (size);
- cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
+ cur_setnum (writer.cur_block, &writer.cur_pos, df);
cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
cur_setnum (writer.cur_block, &writer.cur_pos, p_id);
cur_setnum (writer.cur_block, &writer.cur_pos, o_id);
@@ -430,18 +430,18 @@ tracker_db_journal_append_resource (guint32 s_id,
const gchar *uri)
{
gint o_len;
- gchar data_format;
+ DataFormat df;
gint size;
g_return_val_if_fail (writer.journal > 0, FALSE);
o_len = strlen (uri);
- data_format = DATA_FORMAT_RESOURCE_INSERT;
+ df = DATA_FORMAT_RESOURCE_INSERT;
size = (sizeof (guint32) * 2) + o_len + 1;
cur_block_maybe_expand (size);
- cur_setnum (writer.cur_block, &writer.cur_pos, data_format);
+ cur_setnum (writer.cur_block, &writer.cur_pos, df);
cur_setnum (writer.cur_block, &writer.cur_pos, s_id);
cur_setstr (writer.cur_block, &writer.cur_pos, uri, o_len);
@@ -682,7 +682,7 @@ tracker_db_journal_reader_next (GError **error)
reader.type = TRACKER_DB_JOURNAL_END_TRANSACTION;
return TRUE;
} else {
- guint32 data_format;
+ DataFormat df;
gsize str_length;
if (reader.end - reader.current < sizeof (guint32)) {
@@ -693,10 +693,10 @@ tracker_db_journal_reader_next (GError **error)
return FALSE;
}
- data_format = read_uint32 (reader.current);
+ df = read_uint32 (reader.current);
reader.current += 4;
- if (data_format == DATA_FORMAT_RESOURCE_INSERT) {
+ if (df == DATA_FORMAT_RESOURCE_INSERT) {
reader.type = TRACKER_DB_JOURNAL_RESOURCE;
if (reader.end - reader.current < sizeof (guint32) + 1) {
@@ -729,14 +729,14 @@ tracker_db_journal_reader_next (GError **error)
reader.uri = reader.current;
reader.current += str_length + 1;
} else {
- if (data_format & DATA_FORMAT_OPERATION_DELETE) {
- if (data_format & DATA_FORMAT_OBJECT_ID) {
+ if (df & DATA_FORMAT_OPERATION_DELETE) {
+ if (df & DATA_FORMAT_OBJECT_ID) {
reader.type = TRACKER_DB_JOURNAL_DELETE_STATEMENT_ID;
} else {
reader.type = TRACKER_DB_JOURNAL_DELETE_STATEMENT;
}
} else {
- if (data_format & DATA_FORMAT_OBJECT_ID) {
+ if (df & DATA_FORMAT_OBJECT_ID) {
reader.type = TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID;
} else {
reader.type = TRACKER_DB_JOURNAL_INSERT_STATEMENT;
@@ -757,7 +757,7 @@ tracker_db_journal_reader_next (GError **error)
reader.p_id = read_uint32 (reader.current);
reader.current += 4;
- if (data_format & DATA_FORMAT_OBJECT_ID) {
+ if (df & DATA_FORMAT_OBJECT_ID) {
if (reader.end - reader.current < sizeof (guint32)) {
/* damaged journal entry */
g_set_error (error, TRACKER_DB_JOURNAL_ERROR, 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]