[Groonga-commit] groonga/groonga at 67d907f [master] Use GRN_GCALLOC() instead of GRN_GMALLOC() and memset()

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Jan 17 15:59:58 JST 2015


Kouhei Sutou	2015-01-17 15:59:58 +0900 (Sat, 17 Jan 2015)

  New Revision: 67d907f972cf881e2ec8ebed1ccf8b6c1b106393
  https://github.com/groonga/groonga/commit/67d907f972cf881e2ec8ebed1ccf8b6c1b106393

  Message:
    Use GRN_GCALLOC() instead of GRN_GMALLOC() and memset()
    
    Because grn_io_open() uses it.

  Modified files:
    lib/io.c

  Modified: lib/io.c (+2 -4)
===================================================================
--- lib/io.c    2015-01-17 15:41:49 +0900 (de10cf2)
+++ lib/io.c    2015-01-17 15:59:58 +0900 (2d43af9)
@@ -165,8 +165,7 @@ grn_io_create_tmp(uint32_t header_size, uint32_t segment_size,
     memcpy(header->idstr, GRN_IO_IDSTR, 16);
     if ((io = GRN_GMALLOCN(grn_io, 1))) {
       grn_io_mapinfo *maps = NULL;
-      if (((maps = GRN_GMALLOCN(grn_io_mapinfo, max_segment)) &&
-           memset(maps, 0, sizeof(grn_io_mapinfo) * max_segment))) {
+      if ((maps = GRN_GCALLOC(sizeof(grn_io_mapinfo) * max_segment))) {
         io->header = header;
         io->user_header = (((byte *) header) + IO_HEADER_SIZE);
         io->maps = maps;
@@ -260,8 +259,7 @@ grn_io_create(grn_ctx *ctx, const char *path, uint32_t header_size, uint32_t seg
         grn_msync(ctx, header, b);
         if ((io = GRN_GMALLOCN(grn_io, 1))) {
           grn_io_mapinfo *maps = NULL;
-          if (((maps = GRN_GMALLOCN(grn_io_mapinfo, max_segment)) &&
-               memset(maps, 0, sizeof(grn_io_mapinfo) * max_segment))) {
+          if ((maps = GRN_GCALLOC(sizeof(grn_io_mapinfo) * max_segment))) {
             strncpy(io->path, path, PATH_MAX);
             io->header = header;
             io->user_header = (((byte *) header) + IO_HEADER_SIZE);
-------------- next part --------------
HTML����������������������������...
Download 



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