Navigation Menu

Skip to content

Commit

Permalink
Update the rest of the input string even on error
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yata committed Jan 15, 2015
1 parent 78f5e1f commit 0bc4424
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/dat.cpp
Expand Up @@ -678,6 +678,9 @@ grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
{
if (!grn_dat_open_trie_if_needed(ctx, dat) || !str ||
!(dat->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) || !scan_hits) {
if (str_rest) {
*str_rest = str;
}
return -1;
}

Expand Down Expand Up @@ -783,6 +786,9 @@ grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
} catch (const grn::dat::Exception &ex) {
ERR(grn_dat_translate_error_code(ex.code()),
"grn::dat::lcp_search failed");
if (str_rest) {
*str_rest = str;
}
return -1;
}
return static_cast<int>(num_scan_hits);
Expand Down

0 comments on commit 0bc4424

Please sign in to comment.