[tracker/binary-log-2: 18/48] 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: 18/48] Use typedef enum for journal data formats
- Date: Mon, 11 Jan 2010 15:59:41 +0000 (UTC)
commit b7a8f0240b73cb956891cba7b189c08839051c58
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 fa4dfb1..88d9ab6 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;
@@ -323,19 +323,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);
@@ -351,17 +351,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);
@@ -378,18 +378,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);
@@ -405,17 +405,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);
@@ -431,18 +431,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);
@@ -683,7 +683,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)) {
@@ -694,10 +694,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) {
@@ -730,14 +730,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;
@@ -758,7 +758,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]