[tracker/dbus-fd-experiment] Steroids server: refactor buffer_write_int
- From: Adrien Bustany <abustany src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/dbus-fd-experiment] Steroids server: refactor buffer_write_int
- Date: Fri, 21 May 2010 22:25:55 +0000 (UTC)
commit e80df3bbf56d7e5d11bed82460ccb7b77d636c38
Author: Adrien Bustany <abustany gnome org>
Date: Fri May 21 12:33:55 2010 -0400
Steroids server: refactor buffer_write_int
This commit renames buffer_write_int in client_write_int, and puts the
actual writing logic in a separate function, buffer_write_int.
src/tracker-store/tracker-steroids.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index c0ab655..3b47338 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -94,16 +94,23 @@ destroy_client_info (gpointer user_data)
}
static void
-buffer_write_int (ClientInfo *info, int value)
+buffer_write_int (char *dst, int value)
{
- char *dst = info->send_buffer + info->send_buffer_index;
memset (dst++, (value ) & 0xff, sizeof (char));
memset (dst++, (value >> 8) & 0xff, sizeof (char));
memset (dst++, (value >> 16) & 0xff, sizeof (char));
memset (dst++, (value >> 24) & 0xff, sizeof (char));
+}
+
+static void
+client_write_int (ClientInfo *info, int value)
+{
+ char *dst = info->send_buffer + info->send_buffer_index;
+ buffer_write_int (dst, value);
info->send_buffer_index += sizeof (int);
}
+
static void
page_flush (ClientInfo *info)
{
@@ -230,8 +237,8 @@ query_inthread (TrackerDBCursor *cursor,
page_flush (info);
}
- buffer_write_int (info, STEROIDS_RC_ROW);
- buffer_write_int (info, n_columns);
+ client_write_int (info, STEROIDS_RC_ROW);
+ client_write_int (info, n_columns);
memcpy (info->send_buffer + info->send_buffer_index,
column_offsets,
n_columns * sizeof (int));
@@ -248,7 +255,7 @@ query_inthread (TrackerDBCursor *cursor,
}
page_flush (info);
- buffer_write_int (info, STEROIDS_RC_DONE);
+ client_write_int (info, STEROIDS_RC_DONE);
page_flush (info);
close (info->fd);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]