[Groonga-commit] groonga/groonga at 80da46a [master] Really support conf for temporary database

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Thu Jan 14 23:20:52 JST 2016


Kouhei Sutou	2016-01-14 23:20:52 +0900 (Thu, 14 Jan 2016)

  New Revision: 80da46ab252fde039148ed5bd929f60002250420
  https://github.com/groonga/groonga/commit/80da46ab252fde039148ed5bd929f60002250420

  Message:
    Really support conf for temporary database

  Modified files:
    lib/db.c

  Modified: lib/db.c (+11 -3)
===================================================================
--- lib/db.c    2016-01-14 23:11:38 +0900 (3e0073c)
+++ lib/db.c    2016-01-14 23:20:52 +0900 (d4779e8)
@@ -165,10 +165,17 @@ static grn_bool
 grn_db_conf_create(grn_ctx *ctx, grn_db *s, const char *path,
                    const char *context_tag)
 {
-  char conf_path[PATH_MAX];
+  char *conf_path;
+  char conf_path_buffer[PATH_MAX];
   uint32_t flags = GRN_OBJ_KEY_VAR_SIZE;
 
-  grn_snprintf(conf_path, PATH_MAX, PATH_MAX, GRN_DB_CONF_PATH_FORMAT, path);
+  if (path) {
+    grn_snprintf(conf_path_buffer, PATH_MAX, PATH_MAX,
+                 GRN_DB_CONF_PATH_FORMAT, path);
+    conf_path = conf_path_buffer;
+  } else {
+    conf_path = NULL;
+  }
   s->conf = grn_hash_create(ctx, conf_path,
                             GRN_CONF_MAX_KEY_SIZE,
                             GRN_CONF_VALUE_SPACE_SIZE,
@@ -176,7 +183,8 @@ grn_db_conf_create(grn_ctx *ctx, grn_db *s, const char *path,
   if (!s->conf) {
     ERR(GRN_NO_MEMORY_AVAILABLE,
         "%s failed to create conf: <%s>",
-        context_tag, conf_path);
+        context_tag,
+        conf_path ? conf_path : "(temporary)");
     return GRN_FALSE;
   }
 
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る