[Groonga-commit] groonga/groonga at ad70bb7 [master] grn_ts: don't reallocate memory if there is no size change

Back to archive index

susumu.yata null+****@clear*****
Wed Sep 9 01:10:12 JST 2015


susumu.yata	2015-09-09 01:10:12 +0900 (Wed, 09 Sep 2015)

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

  Message:
    grn_ts: don't reallocate memory if there is no size change
    
    GitHub: #394

  Modified files:
    lib/ts.c

  Modified: lib/ts.c (+3 -0)
===================================================================
--- lib/ts.c    2015-09-09 01:09:14 +0900 (79c42e9)
+++ lib/ts.c    2015-09-09 01:10:12 +0900 (d7506f1)
@@ -114,6 +114,9 @@ grn_ts_buf_reserve(grn_ctx *ctx, grn_ts_buf *buf, size_t new_size) {
 static grn_rc
 grn_ts_buf_resize(grn_ctx *ctx, grn_ts_buf *buf, size_t new_size) {
   void *new_ptr;
+  if (new_size == buf->size) {
+    return GRN_SUCCESS;
+  }
   if (!new_size) {
     if (buf->ptr) {
       GRN_FREE(buf->ptr);
-------------- next part --------------
HTML����������������������������...
다운로드 



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