[Groonga-commit] groonga/groonga [master] Add const specifiers and a type cast from void *.

Back to archive index

null+****@clear***** null+****@clear*****
2012年 3月 30日 (金) 11:00:31 JST


Susumu Yata	2012-03-30 11:00:31 +0900 (Fri, 30 Mar 2012)

  New Revision: 549c9a6dd527ceb2b2dde7b7a8b367dedf45adc5

  Log:
    Add const specifiers and a type cast from void *.

  Modified files:
    lib/hash.c

  Modified: lib/hash.c (+4 -4)
===================================================================
--- lib/hash.c    2012-03-30 10:57:07 +0900 (20b9e7a)
+++ lib/hash.c    2012-03-30 11:00:31 +0900 (d693c8d)
@@ -1209,11 +1209,11 @@ grn_hash_create(grn_ctx *ctx, const char *path, uint32_t key_size, uint32_t valu
 grn_hash *
 grn_hash_open(grn_ctx *ctx, const char *path)
 {
-  grn_io *io = grn_io_open(ctx, path, grn_io_auto);
+  grn_io * const io = grn_io_open(ctx, path, grn_io_auto);
   if (io) {
-    struct grn_hash_header *header = grn_io_header(io);
+    struct grn_hash_header * const header = grn_io_header(io);
     if (grn_io_get_type(io) == GRN_TABLE_HASH_KEY) {
-      grn_hash *hash = GRN_MALLOC(sizeof(grn_hash));
+      grn_hash * const hash = (grn_hash *)GRN_MALLOC(sizeof(grn_hash));
       if (hash) {
         if (!(header->flags & GRN_HASH_TINY)) {
           GRN_DB_OBJ_SET_TYPE(hash, GRN_TABLE_HASH_KEY);
@@ -1230,7 +1230,7 @@ grn_hash_open(grn_ctx *ctx, const char *path)
           hash->header = header;
           hash->lock = &header->lock;
           hash->tokenizer = grn_ctx_at(ctx, header->tokenizer);
-          return (grn_hash *)hash;
+          return hash;
         } else {
           GRN_LOG(ctx, GRN_LOG_NOTICE, "invalid hash flag. (%x)", header->flags);
         }




Groonga-commit メーリングリストの案内
Back to archive index