<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -407,7 +407,8 @@ char* do_item_stats_sizes(int *bytes) {
     *bytes = 0;
     for (i = 0; i &lt; num_buckets; i++) {
         if (histogram[i] != 0) {
-            offset = append_to_buffer(buf, bufsize, offset, sizeof(terminator), &quot;%d %u\r\n&quot;, i * 32, histogram[i]);
+            offset = append_to_buffer(buf, bufsize, offset,
+                sizeof(terminator), &quot;%d %u\r\n&quot;, i * 32, histogram[i]);
         }
     }
     offset = append_to_buffer(buf, bufsize, offset, 0, terminator);</diff>
      <filename>items.c</filename>
    </modified>
    <modified>
      <diff>@@ -1044,6 +1044,14 @@ inline static void process_stats_detail(conn *c, const char *command) {
     }
 }
 
+/* Macros to DRY out the code a bit and shorten the lines some. */
+#define SPCAT1(a) offset = append_to_buffer( \
+        temp, bufsize, offset, sizeof(terminator), a)
+#define SPCAT2(a,b) offset = append_to_buffer( \
+        temp, bufsize, offset, sizeof(terminator), a, b)
+#define SPCAT3(a,b,c) offset = append_to_buffer( \
+        temp, bufsize, offset, sizeof(terminator), a, b, c)
+
 static void process_stat(conn *c, token_t *tokens, const size_t ntokens) {
     rel_time_t now = current_time;
     char *command;
@@ -1070,31 +1078,39 @@ static void process_stat(conn *c, token_t *tokens, const size_t ntokens) {
 #endif /* !WIN32 */
 
         STATS_LOCK();
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT pid %u\r\n&quot;, pid);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT uptime %u\r\n&quot;, now);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT time %ld\r\n&quot;, now + stats.started);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT version &quot; VERSION &quot;\r\n&quot;);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT pointer_size %lu\r\n&quot;, 8 * sizeof(void *));
+        SPCAT2(&quot;STAT pid %u\r\n&quot;, pid);
+        SPCAT2(&quot;STAT uptime %u\r\n&quot;, now);
+        SPCAT2(&quot;STAT time %ld\r\n&quot;, now + stats.started);
+        SPCAT1(&quot;STAT version &quot; VERSION &quot;\r\n&quot;);
+        SPCAT2(&quot;STAT pointer_size %lu\r\n&quot;, 8 * sizeof(void *));
 #ifndef WIN32
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT rusage_user %ld.%06d\r\n&quot;, usage.ru_utime.tv_sec, (int) usage.ru_utime.tv_usec);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT rusage_system %ld.%06d\r\n&quot;, usage.ru_stime.tv_sec, (int) usage.ru_stime.tv_usec);
+        SPCAT3(&quot;STAT rusage_user %ld.%06d\r\n&quot;,
+            usage.ru_utime.tv_sec, (int) usage.ru_utime.tv_usec);
+        SPCAT3(&quot;STAT rusage_system %ld.%06d\r\n&quot;,
+            usage.ru_stime.tv_sec, (int) usage.ru_stime.tv_usec);
 #endif /* !WIN32 */
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT curr_items %u\r\n&quot;, stats.curr_items);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT total_items %u\r\n&quot;, stats.total_items);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT bytes %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.curr_bytes);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT curr_connections %u\r\n&quot;, stats.curr_conns - 1); /* ignore listening conn */
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT total_connections %u\r\n&quot;, stats.total_conns);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT connection_structures %u\r\n&quot;, stats.conn_structs);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT cmd_get %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.get_cmds);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT cmd_set %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.set_cmds);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT get_hits %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.get_hits);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT get_misses %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.get_misses);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT hit_rate %g%%\r\n&quot;, (stats.get_hits + stats.get_misses) == 0 ? 0.0 : (double)stats.get_hits * 100 / (stats.get_hits + stats.get_misses));
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT evictions %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.evictions);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT bytes_read %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.bytes_read);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT bytes_written %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.bytes_written);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT limit_maxbytes %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, (uint64_t) settings.maxbytes);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT threads %u\r\n&quot;, settings.num_threads);
+        SPCAT2(&quot;STAT curr_items %u\r\n&quot;, stats.curr_items);
+        SPCAT2(&quot;STAT total_items %u\r\n&quot;, stats.total_items);
+        SPCAT2(&quot;STAT bytes %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.curr_bytes);
+        /* ignore listening conn */
+        SPCAT2(&quot;STAT curr_connections %u\r\n&quot;, stats.curr_conns - 1);
+        SPCAT2(&quot;STAT total_connections %u\r\n&quot;, stats.total_conns);
+        SPCAT2(&quot;STAT connection_structures %u\r\n&quot;, stats.conn_structs);
+        SPCAT2(&quot;STAT cmd_get %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.get_cmds);
+        SPCAT2(&quot;STAT cmd_set %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.set_cmds);
+        SPCAT2(&quot;STAT get_hits %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;,
+            stats.get_hits);
+        SPCAT2(&quot;STAT get_misses %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;,
+            stats.get_misses);
+        SPCAT2(&quot;STAT hit_rate %g%%\r\n&quot;,
+            (stats.get_hits + stats.get_misses) == 0 ? 0.0 :
+                (double)stats.get_hits * 100 / (stats.get_hits + stats.get_misses));
+        SPCAT2(&quot;STAT evictions %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.evictions);
+        SPCAT2(&quot;STAT bytes_read %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.bytes_read);
+        SPCAT2(&quot;STAT bytes_written %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;, stats.bytes_written);
+        SPCAT2(&quot;STAT limit_maxbytes %&quot; PRINTF_INT64_MODIFIER &quot;u\r\n&quot;,
+            (uint64_t) settings.maxbytes);
+        SPCAT2(&quot;STAT threads %u\r\n&quot;, settings.num_threads);
         offset = append_to_buffer(temp, bufsize, offset, 0, terminator);
         STATS_UNLOCK();
         out_string(c, temp);
@@ -1118,16 +1134,16 @@ static void process_stat(conn *c, token_t *tokens, const size_t ntokens) {
         struct mallinfo info;
 
         info = mallinfo();
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT arena_size %d\r\n&quot;, info.arena);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT free_chunks %d\r\n&quot;, info.ordblks);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT fastbin_blocks %d\r\n&quot;, info.smblks);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT mmapped_regions %d\r\n&quot;, info.hblks);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT mmapped_space %d\r\n&quot;, info.hblkhd);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT max_total_alloc %d\r\n&quot;, info.usmblks);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT fastbin_space %d\r\n&quot;, info.fsmblks);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT total_alloc %d\r\n&quot;, info.uordblks);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT total_free %d\r\n&quot;, info.fordblks);
-        offset = append_to_buffer(temp, bufsize, offset, sizeof(terminator), &quot;STAT releasable_space %d\r\n&quot;, info.keepcost);
+        SPCAT2(&quot;STAT arena_size %d\r\n&quot;, info.arena);
+        SPCAT2(&quot;STAT free_chunks %d\r\n&quot;, info.ordblks);
+        SPCAT2(&quot;STAT fastbin_blocks %d\r\n&quot;, info.smblks);
+        SPCAT2(&quot;STAT mmapped_regions %d\r\n&quot;, info.hblks);
+        SPCAT2(&quot;STAT mmapped_space %d\r\n&quot;, info.hblkhd);
+        SPCAT2(&quot;STAT max_total_alloc %d\r\n&quot;, info.usmblks);
+        SPCAT2(&quot;STAT fastbin_space %d\r\n&quot;, info.fsmblks);
+        SPCAT2(&quot;STAT total_alloc %d\r\n&quot;, info.uordblks);
+        SPCAT2(&quot;STAT total_free %d\r\n&quot;, info.fordblks);
+        SPCAT2(&quot;STAT releasable_space %d\r\n&quot;, info.keepcost);
         offset = append_to_buffer(temp, bufsize, offset, 0, terminator);
         out_string(c, temp);
         return;</diff>
      <filename>memcached.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d8e7fcb2a62908510eae38fbe36b42352f977b5b</id>
    </parent>
  </parents>
  <author>
    <name>Dustin Sallings</name>
    <email>dustin@spy.net</email>
  </author>
  <url>http://github.com/dustin/memcached/commit/bb4bc68c350f57b8748d47b3ff77b50bbac9c933</url>
  <id>bb4bc68c350f57b8748d47b3ff77b50bbac9c933</id>
  <committed-date>2008-05-16T23:30:10-07:00</committed-date>
  <authored-date>2008-05-16T23:22:57-07:00</authored-date>
  <message>Remove some duplication and shorten some lines.</message>
  <tree>718a2bdc48664090f5bcd147f1eca42b18a798f3</tree>
  <committer>
    <name>Dustin Sallings</name>
    <email>dustin@spy.net</email>
  </committer>
</commit>
