[Groonga-commit] groonga/groonga at c17c2d0 [master] grn_ts: rename an argument of grn_ts_buf_reserve()

Back to archive index

susumu.yata null+****@clear*****
Tue Nov 24 15:34:43 JST 2015


susumu.yata	2015-11-24 15:34:43 +0900 (Tue, 24 Nov 2015)

  New Revision: c17c2d00ea842ad379a27778878917515eb6d219
  https://github.com/groonga/groonga/commit/c17c2d00ea842ad379a27778878917515eb6d219

  Message:
    grn_ts: rename an argument of grn_ts_buf_reserve()

  Modified files:
    lib/ts/ts_buf.c
    lib/ts/ts_buf.h

  Modified: lib/ts/ts_buf.c (+4 -4)
===================================================================
--- lib/ts/ts_buf.c    2015-11-24 15:28:50 +0900 (0801db6)
+++ lib/ts/ts_buf.c    2015-11-24 15:34:43 +0900 (ad44723)
@@ -71,19 +71,19 @@ grn_ts_buf_close(grn_ctx *ctx, grn_ts_buf *buf)
 */
 
 grn_rc
-grn_ts_buf_reserve(grn_ctx *ctx, grn_ts_buf *buf, size_t new_size)
+grn_ts_buf_reserve(grn_ctx *ctx, grn_ts_buf *buf, size_t min_size)
 {
   void *new_ptr;
   size_t enough_size;
-  if (new_size <= buf->size) {
+  if (min_size <= buf->size) {
     return GRN_SUCCESS;
   }
   enough_size = buf->size ? (buf->size << 1) : 1;
-  while (enough_size < new_size) {
+  while (enough_size < min_size) {
     if ((enough_size << 1) < enough_size) {
       GRN_TS_ERR_RETURN(GRN_INVALID_ARGUMENT,
                         "size overflow: %" GRN_FMT_SIZE,
-                        new_size);
+                        min_size);
     }
     enough_size <<= 1;
   }

  Modified: lib/ts/ts_buf.h (+5 -5)
===================================================================
--- lib/ts/ts_buf.h    2015-11-24 15:28:50 +0900 (01f9851)
+++ lib/ts/ts_buf.h    2015-11-24 15:34:43 +0900 (c9c86ff)
@@ -54,17 +54,17 @@ void grn_ts_buf_close(grn_ctx *ctx, grn_ts_buf *buf);
 #endif
 
 /*
- * grn_ts_buf_reserve() reserves enough memory to store new_size bytes.
- * Note that this function never shrinks a buffer and does nothing if new_size
- * is not greater than the current size.
+ * grn_ts_buf_reserve() reserves enough memory to store `min_size` bytes.
+ * Note that this function never shrinks a buffer and does nothing if
+ * `min_size` is not greater than `buf->size`.
  */
-grn_rc grn_ts_buf_reserve(grn_ctx *ctx, grn_ts_buf *buf, size_t new_size);
+grn_rc grn_ts_buf_reserve(grn_ctx *ctx, grn_ts_buf *buf, size_t min_size);
 
 /* grn_ts_buf_resize() resizes a buffer. */
 grn_rc grn_ts_buf_resize(grn_ctx *ctx, grn_ts_buf *buf, size_t new_size);
 
 /*
- * grn_ts_buf_write() writes data into a buffer. buf->pos specifies the
+ * grn_ts_buf_write() writes data into a buffer. `buf->pos` specifies the
  * position and it will be modified on success.
  * Note that this function resizes a buffer if required.
  */
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index