Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2020-02-07 08:51:20 +02:00
commit 8b6cfda631
69 changed files with 587 additions and 294 deletions

View file

@ -4315,7 +4315,7 @@ grn_ii_remove(grn_ctx *ctx, const char *path)
if (!path || strlen(path) > PATH_MAX - 4) { return GRN_INVALID_ARGUMENT; }
if ((rc = grn_io_remove(ctx, path))) { goto exit; }
grn_snprintf(buffer, PATH_MAX, PATH_MAX,
"%s.c", path);
"%-.256s.c", path);
rc = grn_io_remove(ctx, buffer);
exit :
return rc;
@ -4331,12 +4331,12 @@ grn_ii_truncate(grn_ctx *ctx, grn_ii *ii)
uint32_t flags;
if ((io_segpath = grn_io_path(ii->seg)) && *io_segpath != '\0') {
if (!(segpath = GRN_STRDUP(io_segpath))) {
ERR(GRN_NO_MEMORY_AVAILABLE, "cannot duplicate path: <%s>", io_segpath);
ERR(GRN_NO_MEMORY_AVAILABLE, "cannot duplicate path: <%-.256s>", io_segpath);
return GRN_NO_MEMORY_AVAILABLE;
}
if ((io_chunkpath = grn_io_path(ii->chunk)) && *io_chunkpath != '\0') {
if (!(chunkpath = GRN_STRDUP(io_chunkpath))) {
ERR(GRN_NO_MEMORY_AVAILABLE, "cannot duplicate path: <%s>", io_chunkpath);
ERR(GRN_NO_MEMORY_AVAILABLE, "cannot duplicate path: <%-.256s>", io_chunkpath);
return GRN_NO_MEMORY_AVAILABLE;
}
} else {
@ -5144,7 +5144,7 @@ grn_ii_cursor_set_min(grn_ctx *ctx, grn_ii_cursor *c, grn_id min)
c->stat |= CHUNK_USED;
GRN_LOG(ctx, GRN_LOG_DEBUG,
"[ii][cursor][min] skip: %p: min(%u->%u): chunk(%u->%u): "
"chunk-used(%s->%s)",
"chunk-used(%-.256s->%-.256s)",
c,
old_min, min,
old_chunk, c->curr_chunk,
@ -5205,7 +5205,7 @@ grn_ii_cursor_next_internal(grn_ctx *ctx, grn_ii_cursor *c,
}
GRN_TEXT_PUTC(ctx, &buf, ')');
GRN_TEXT_PUTC(ctx, &buf, '\0');
GRN_LOG(ctx, GRN_LOG_DEBUG, "posting(%d):%s", count, GRN_TEXT_VALUE(&buf));
GRN_LOG(ctx, GRN_LOG_DEBUG, "posting(%d):%-.256s", count, GRN_TEXT_VALUE(&buf));
GRN_OBJ_FIN(ctx, &buf);
}
*/
@ -6451,7 +6451,7 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
ERR(GRN_INVALID_ARGUMENT,
"[ii][column][update][new] invalid object: "
"<%.*s>: "
"<%s>(%#x)",
"<%-.256s>(%#x)",
name_size, name,
grn_obj_type_to_string(type),
type);
@ -6564,7 +6564,7 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
ERR(GRN_INVALID_ARGUMENT,
"[ii][column][update][old] invalid object: "
"<%.*s>: "
"<%s>(%#x)",
"<%-.256s>(%#x)",
name_size, name,
grn_obj_type_to_string(type),
type);
@ -7833,7 +7833,7 @@ grn_ii_select_cursor_open(grn_ctx *ctx,
default :
ERR(GRN_INVALID_ARGUMENT,
"[ii][select][cursor][open] "
"EXACT, FUZZY, NEAR and NEAR2 are only supported mode: %s",
"EXACT, FUZZY, NEAR and NEAR2 are only supported mode: %-.256s",
grn_operator_to_string(mode));
break;
}
@ -7841,7 +7841,7 @@ grn_ii_select_cursor_open(grn_ctx *ctx,
cursor = GRN_CALLOC(sizeof(grn_ii_select_cursor));
if (!cursor) {
ERR(ctx->rc,
"[ii][select][cursor][open] failed to allocate cursor: %s",
"[ii][select][cursor][open] failed to allocate cursor: %-.256s",
ctx->errbuf);
return NULL;
}
@ -7851,7 +7851,7 @@ grn_ii_select_cursor_open(grn_ctx *ctx,
if (!(cursor->tis = GRN_MALLOC(sizeof(token_info *) * string_len * 2))) {
ERR(ctx->rc,
"[ii][select][cursor][open] failed to allocate token info container: %s",
"[ii][select][cursor][open] failed to allocate token info container: %-.256s",
ctx->errbuf);
GRN_FREE(cursor);
return NULL;
@ -7891,7 +7891,7 @@ grn_ii_select_cursor_open(grn_ctx *ctx,
case GRN_OP_NEAR :
if (!(cursor->bt = bt_open(ctx, cursor->n_tis))) {
ERR(ctx->rc,
"[ii][select][cursor][open] failed to allocate btree: %s",
"[ii][select][cursor][open] failed to allocate btree: %-.256s",
ctx->errbuf);
grn_ii_select_cursor_close(ctx, cursor);
return NULL;
@ -8114,7 +8114,7 @@ grn_ii_parse_regexp_query(grn_ctx *ctx,
if (char_len == 0) {
GRN_OBJ_FIN(ctx, &buffer);
ERR(GRN_INVALID_ARGUMENT,
"%s invalid encoding character: <%.*s|%#x|>",
"%-.256s invalid encoding character: <%.*s|%#x|>",
log_tag,
(int)(current - string), string,
*current);
@ -8515,7 +8515,7 @@ grn_ii_select_sequential_search(grn_ctx *ctx,
onig_error_code_to_str(message, onig_result, error_info);
GRN_LOG(ctx, GRN_LOG_WARNING,
"[ii][select][sequential] "
"failed to create regular expression object: %s",
"failed to create regular expression object: %-.256s",
message);
processed = GRN_FALSE;
}
@ -10148,7 +10148,7 @@ grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
ii_buffer->block_buf = GRN_MALLOCN(grn_id, II_BUFFER_BLOCK_SIZE);
if (ii_buffer->block_buf) {
grn_snprintf(ii_buffer->tmpfpath, PATH_MAX, PATH_MAX,
"%sXXXXXX", grn_io_path(ii->seg));
"%-.256sXXXXXX", grn_io_path(ii->seg));
ii_buffer->block_buf_size = II_BUFFER_BLOCK_SIZE;
ii_buffer->tmpfd = grn_mkstemp(ii_buffer->tmpfpath);
if (ii_buffer->tmpfd != -1) {
@ -10161,7 +10161,7 @@ grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
}
return ii_buffer;
} else {
SERR("failed grn_mkstemp(%s)",
SERR("failed grn_mkstemp(%-.256s)",
ii_buffer->tmpfpath);
}
GRN_FREE(ii_buffer->block_buf);
@ -10308,7 +10308,7 @@ grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
ii_buffer->tmpfpath,
O_RDONLY | GRN_OPEN_FLAG_BINARY);
if (ii_buffer->tmpfd == -1) {
ERRNO_ERR("failed to open path: <%s>", ii_buffer->tmpfpath);
ERRNO_ERR("failed to open path: <%-.256s>", ii_buffer->tmpfpath);
return ctx->rc;
}
{
@ -10358,10 +10358,10 @@ grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
grn_close(ii_buffer->tmpfd);
if (grn_unlink(ii_buffer->tmpfpath) == 0) {
GRN_LOG(ctx, GRN_LOG_INFO,
"[ii][buffer][commit] removed temporary path: <%s>",
"[ii][buffer][commit] removed temporary path: <%-.256s>",
ii_buffer->tmpfpath);
} else {
ERRNO_ERR("[ii][buffer][commit] failed to remove temporary path: <%s>",
ERRNO_ERR("[ii][buffer][commit] failed to remove temporary path: <%-.256s>",
ii_buffer->tmpfpath);
}
ii_buffer->tmpfd = -1;
@ -10385,10 +10385,10 @@ grn_ii_buffer_close(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
grn_close(ii_buffer->tmpfd);
if (grn_unlink(ii_buffer->tmpfpath) == 0) {
GRN_LOG(ctx, GRN_LOG_INFO,
"[ii][buffer][close] removed temporary path: <%s>",
"[ii][buffer][close] removed temporary path: <%-.256s>",
ii_buffer->tmpfpath);
} else {
ERRNO_ERR("[ii][buffer][close] failed to remove temporary path: <%s>",
ERRNO_ERR("[ii][buffer][close] failed to remove temporary path: <%-.256s>",
ii_buffer->tmpfpath);
}
}
@ -11468,10 +11468,10 @@ grn_ii_builder_fin(grn_ctx *ctx, grn_ii_builder *builder)
grn_close(builder->fd);
if (grn_unlink(builder->path) == 0) {
GRN_LOG(ctx, GRN_LOG_INFO,
"[ii][builder][fin] removed path: <%s>",
"[ii][builder][fin] removed path: <%-.256s>",
builder->path);
} else {
ERRNO_ERR("[ii][builder][fin] failed to remove path: <%s>",
ERRNO_ERR("[ii][builder][fin] failed to remove path: <%-.256s>",
builder->path);
}
}
@ -11779,10 +11779,10 @@ static grn_rc
grn_ii_builder_create_file(grn_ctx *ctx, grn_ii_builder *builder)
{
grn_snprintf(builder->path, PATH_MAX, PATH_MAX,
"%sXXXXXX", grn_io_path(builder->ii->seg));
"%-.256sXXXXXX", grn_io_path(builder->ii->seg));
builder->fd = grn_mkstemp(builder->path);
if (builder->fd == -1) {
SERR("failed to create a temporary file: path = \"%s\"",
SERR("failed to create a temporary file: path = \"%-.256s\"",
builder->path);
return ctx->rc;
}