<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <dl style="line-height: 1.5; margin-left: 2em">
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Author</dt>
      <dd style="margin-left: 8.5em">Kouhei Sutou &lt;kou****@clear*****&gt;</dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Date</dt>
      <dd style="margin-left: 8.5em">2015-01-16 14:49:37 +0900 (Fri, 16 Jan 2015)</dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">New Revision</dt>
      <dd style="margin-left: 8.5em"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240">bd55bd9b0e24b577a4c55c19f54806cf922da240</a></dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Message</dt>
      <dd style="margin-left: 8.5em"><pre style="border: 1px solid #aaa; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; padding: 0.5em; width: auto">io: share common code to compute base segment address</pre></dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Modified files</dt>
      <dd style="margin-left: 8.5em">
        <ul>
          <li><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#diff-0">lib/io.c</a></li>
        </ul>
      </dd>
    </dl>

    <div class="diff-section" style="clear: both">
      <table style="border-collapse: collapse; border: 1px solid #aaa">
        <thead>
          <tr class="diff-header" style="border: 1px solid #aaa">
            <td colspan="3">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">  Modified: lib/io.c (+8 -2)</span>
<span class="diff-header-mark" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">===================================================================</span>
</pre>
            </td>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L110">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L111">111</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L112">112</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L113">113</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L114">114</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L115">115</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L116">116</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L206">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L207">207</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L208">208</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L209">209</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L210">210</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L211">211</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L212">212</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L213">213</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L454">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L455">455</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L456">456</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L457">457</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L458">458</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L459">459</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L460">460</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0L461">461</a></span>
</pre>
            </th>
            <th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R110">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R111">111</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R112">112</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R113">113</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R114">114</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R115">115</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R116">116</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R117">117</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R118">118</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R119">119</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R120">120</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R121">121</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R122">122</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R212">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R213">213</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R214">214</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R215">215</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R216">216</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R217">217</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R218">218</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R219">219</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R460">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R461">461</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R462">462</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R463">463</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R464">464</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R465">465</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R466">466</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/bd55bd9b0e24b577a4c55c19f54806cf922da240#L0R467">467</a></span>
</pre>
            </th>
            <td class="diff-content" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -111,6 +111,12 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">grn_io_compute_base(uint32_t header_size)</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre">   return (total_header_size + grn_pagesize - 1) &amp; ~(grn_pagesize - 1);</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> }</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> </span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+static inline uint32_t</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+grn_io_compute_base_segment(uint32_t base, uint32_t segment_size)</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+{</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+  return (base + segment_size - 1) / segment_size;</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+}</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> grn_io *</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> grn_io_create_tmp(uint32_t header_size, uint32_t segment_size,</span>
<span class="diff-not-changed" style="display: block; white-space: pre">                   uint32_t max_segment, grn_io_mode mode, uint32_t flags)</span>
<span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -207,7 +213,7 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">grn_io_create(grn_ctx *ctx, const char *path, uint32_t header_size, uint32_t seg</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre">   }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   if (!*path || (strlen(path) &gt; PATH_MAX - 4)) { return NULL; }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   b = grn_io_compute_base(header_size);</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">-  bs = (b + segment_size - 1) / segment_size;</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+  bs = grn_io_compute_base_segment(b, segment_size);</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   max_nfiles = (unsigned int)(</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     ((uint64_t)segment_size * (max_segment + bs) + GRN_IO_FILE_SIZE - 1)</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     / GRN_IO_FILE_SIZE);</span>
<span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -455,7 +461,7 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre">     if (!segment_size) { return NULL; }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   b = grn_io_compute_base(header_size);</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">-  bs = (b + segment_size - 1) / segment_size;</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+  bs = grn_io_compute_base_segment(b, segment_size);</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   max_nfiles = (unsigned int)(</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     ((uint64_t)segment_size * (max_segment + bs) + GRN_IO_FILE_SIZE - 1)</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     / GRN_IO_FILE_SIZE);</span>
</pre>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>