forked from groonga/groonga
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db: return a value of grn_rc type instead of void #3
Open
komainu8
wants to merge
78
commits into
main
Choose a base branch
from
return-grn-rc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groongaGH-1638 This is part of the task of replacing grn_bool with bool. Not all of proc.c has been replaced. In this commit, only some of it was replaced.
groongaGH-1638 This is part of the task of replacing grn_bool with bool. Not all of index_column.c has been replaced. In this commit, only some of it was replaced.
groongaGH-1638 grn_bool and bool were mixed up.
groongaGH-1638 This is part of the task of replacing grn_bool with bool.
…eader file (groonga#1954) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
… file (groonga#1958) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
macos-12 is deprecated.
Co-authored-by: takuya kodama <otegami@clear-code.com>
GitHub: fix groongaGH-1733 See also: groongaGH-1732
It seems that macOS has different floating point number precision than Linux.
We'll drop support for GNU Autotools soon. So we don't want to maintain this case.
This also fixes a build error on Alpine Linux 3.20.
groongaGH-1638 This is part of the task of replacing grn_bool with bool. Not all of geo.c has been replaced. In this commit, only some of it was replaced.
…eader file (groonga#1964) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…roonga#1965) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…der file (groonga#1968) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…rmalize_options from grn_bool to bool GitHub: groongaGH-1638 This is part of the task of replacing grn_bool with bool.
GitHub: groongaGH-1638 This is part of the task of replacing grn_bool with bool.
…ile (groonga#1971) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…roonga#1969) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…ile (groonga#1973) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…() reference to the header file (groonga#1974) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
infererncer -> inferencer
RC must be treated as int16_t not int32_t or something.
…roonga#1983) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…groonga#1986) GitHub: groonga#1817 Prepare to switch to documents automatically generated by Doxygen.
…roonga#1985) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…roonga#1988) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
Because there is a rpath issue in Rroonga. Once resolved, we should enable mruby test on macos-latest.
…ile (groonga#1990) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…ile (groonga#1991) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…onga#1992) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
Generally, functions for release resource do nothing when NULL is specified like "free(NULL)". This changes API but this doesn't break backward compatibility. Because no code exist that use the return value of `grn_obj_close()` when we specify `grn_obj_close(ctx, NULL)` as below. --- Following functions use the return value of `grn_obj_close()`. ``` ./lib/com.c: if (ctx == msg->ctx) { return grn_obj_close(ctx, obj); } ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: rc = grn_obj_close(ctx, obj); ./lib/db.c: return grn_obj_close(ctx, obj); ``` --- `grn_obj_close()` is used in `grn_msg_close()`. However, the return value of `grn_msg_close()` uses no one. ``` % grep -r grn_msg_close ./**/*.c ./lib/com.c:grn_msg_close(grn_ctx *ctx, grn_obj *obj) ./lib/com.c: grn_msg_close(ctx, msg); ./lib/com.c: grn_msg_close(ctx, msg); ./src/grnslap.c: grn_msg_close(ctx, msg); ./src/groonga.c: grn_msg_close(&edge->ctx, msg); ./src/groonga.c: grn_msg_close(ctx, msg); ./src/groonga.c: grn_msg_close(&edge->ctx, obj); ./src/groonga.c: grn_msg_close(ctx, obj); ./src/groonga.c: grn_msg_close(ctx, (grn_obj *)msg); ./src/groonga.c: grn_msg_close(ctx, msg); ./src/groonga.c: grn_msg_close(ctx, msg); ./src/groonga.c: grn_msg_close(ctx, msg); ./src/groonga.c: grn_msg_close(ctx, msg); ./src/groonga.c: grn_msg_close(ctx, msg); ``` --- `grn_obj_close()` is used in `grn_obj_remove_other()`. `grn_obj_remove_other()` is used in `grn_obj_remove_internal()`. `grn_obj_remove_internal()` is used as below. ``` ./lib/db.c: rc = grn_obj_remove_internal(ctx, target, flags); ./lib/db.c: rc = grn_obj_remove_internal(ctx, column, flags); ./lib/db.c: rc = grn_obj_remove_internal(ctx, obj, 0); ./lib/db.c: rc = grn_obj_remove_internal(ctx, obj, 0); ./lib/db.c: rc = grn_obj_remove_internal(ctx, obj, 0); ./lib/db.c: rc = grn_obj_remove_internal(ctx, obj, 0); ./lib/db.c: rc = grn_obj_remove_internal(ctx, object, flags); ./lib/db.c: rc = grn_obj_remove_internal(ctx, object, flags); ./lib/db.c: rc = grn_obj_remove_internal(ctx, obj, flags); ./lib/db.c: rc = grn_obj_remove_internal(ctx, obj, flags); ./lib/db.c: rc = grn_obj_remove_internal(ctx, obj, flags); ``` --- `grn_obj_remove_internal()` is used in `remove_index()`. However, `grn_obj_remove_internal()` is not called when `target` is `NULL` as below. ```c if (!target) { ... } } else if (target->header.type == GRN_COLUMN_INDEX) { // TODO: multicolumn MULTI_COLUMN_INDEXP rc = grn_obj_remove_internal(ctx, target, flags); } ``` So, this changes API does not affect. --- `grn_obj_remove_internal()` is used in `remove_columns_raw()` However, `grn_obj_remove_internal()` is not called when `column` is `NULL` as below. ```c if (column) { rc = grn_obj_remove_internal(ctx, column, flags); if (rc != GRN_SUCCESS) { grn_obj_unlink(ctx, column); break; } } ... ``` So, this changes API does not affect. --- `grn_obj_remove_internal()` is used in `grn_obj_remove_db_index_columns()`. However, `grn_obj_remove_internal()` is not called when `obj` is `NULL` as below. ```c if (obj && obj->header.type == GRN_COLUMN_INDEX) { rc = grn_obj_remove_internal(ctx, obj, 0); ... } ``` So, this changes API does not affect. --- `grn_obj_remove_internal()` is used in `grn_obj_remove_db_reference_columns()`. However, `grn_obj_remove_internal()` is not called when `obj` is `NULL` as below. ```c while ((id = grn_table_cursor_next_inline(ctx, cur)) != GRN_ID_NIL) { grn_obj *obj = grn_ctx_at(ctx, id); grn_obj *range = NULL; if (!obj) { continue; } ... switch (range->header.type) { case GRN_TABLE_NO_KEY: case GRN_TABLE_HASH_KEY: case GRN_TABLE_PAT_KEY: case GRN_TABLE_DAT_KEY: rc = grn_obj_remove_internal(ctx, obj, 0); break; } ... } ``` So, this changes API does not affect. --- `grn_obj_remove_internal()` is used in `grn_obj_remove_db_reference_tables()`. However, `grn_obj_remove_internal()` is not called when `obj` is `NULL` as below. ```c while ((id = grn_table_cursor_next_inline(ctx, cur)) != GRN_ID_NIL) { grn_obj *obj = grn_ctx_at(ctx, id); grn_obj *domain = NULL; if (!obj) { continue; } ... switch (domain->header.type) { case GRN_TABLE_NO_KEY: case GRN_TABLE_HASH_KEY: case GRN_TABLE_PAT_KEY: case GRN_TABLE_DAT_KEY: rc = grn_obj_remove_internal(ctx, obj, 0); break; } ... } ``` So, this changes API does not affect. --- `grn_obj_remove_internal()` is used in `grn_obj_remove_db_all_tables()` However, `grn_obj_remove_internal()` is not called when `obj` is `NULL` as below. ```c while ((id = grn_table_cursor_next_inline(ctx, cur)) != GRN_ID_NIL) { grn_obj *obj = grn_ctx_at(ctx, id); if (!obj) { continue; } ... switch (obj->header.type) { case GRN_TABLE_NO_KEY: case GRN_TABLE_HASH_KEY: case GRN_TABLE_PAT_KEY: case GRN_TABLE_DAT_KEY: rc = grn_obj_remove_internal(ctx, obj, 0); break; } ... } ``` So, this changes API does not affect. --- `grn_obj_remove_internal()` is used in `remove_reference_tables_raw()`. However, `grn_obj_remove_internal()` is not called when `object` is `NULL` as below. ```c object = grn_ctx_at(ctx, id); if (!object) { ... switch (object->header.type) { case GRN_TABLE_HASH_KEY: case GRN_TABLE_PAT_KEY: case GRN_TABLE_DAT_KEY: if (DB_OBJ(object)->id == table_id) { break; } if (object->header.domain == table_id) { rc = grn_obj_remove_internal(ctx, object, flags); is_removed = (grn_table_at(ctx, db, id) == GRN_ID_NIL); } break; ... case GRN_COLUMN_VAR_SIZE: case GRN_COLUMN_FIX_SIZE: if (object->header.domain == table_id) { break; } if (DB_OBJ(object)->range == table_id) { rc = grn_obj_remove_internal(ctx, object, flags); is_removed = (grn_table_at(ctx, db, id) == GRN_ID_NIL); } break; ... } ``` So, this changes API does not affect. --- `grn_obj_remove_internal()` is used in `grn_ctx_remove_by_id_internal()`. However, `grn_obj_remove_internal()` is not called when `obj` is `NULL` as below. ```c if (obj) { grn_rc rc; if (is_top_level) { rc = grn_obj_remove_flags(ctx, obj, flags); } else { rc = grn_obj_remove_internal(ctx, obj, flags); } ... } ``` So, this changes API does not affect. --- `grn_obj_remove_flags()` is used as below. ``` ./lib/db.c: return grn_obj_remove_flags(ctx, obj, 0); ./lib/db.c: return grn_obj_remove_flags(ctx, obj, GRN_OBJ_REMOVE_DEPENDENT); ./lib/db.c: grn_rc rc = grn_obj_remove_flags(ctx, obj, flags); ./lib/db.c: rc = grn_obj_remove_flags(ctx, obj, flags); ``` `grn_obj_remove_flags()` is used in `grn_ctx_remove_by_id_internal()`. However, `grn_obj_remove_flags()` is not called when `obj` is `NULL` as below. ```c if (obj) { grn_rc rc; if (is_top_level) { rc = grn_obj_remove_flags(ctx, obj, flags); } else { rc = grn_obj_remove_internal(ctx, obj, flags); } ... } ``` So, this changes API does not affect. --- `grn_obj_remove_flags()` is used in `grn_obj_remove_dependent()`. However, the return value of `grn_obj_remove_dependent()` uses no one. ``` % grep -r grn_obj_remove_dependent ./**/*.c ./lib/db.c:grn_obj_remove_dependent(grn_ctx *ctx, grn_obj *obj) ``` --- `grn_obj_remove_flags()` is used in `grn_ctx_remove()`. However, `grn_obj_remove_flags()` is not called when `obj` is `NULL` as below. ```c grn_obj *obj = grn_ctx_get(ctx, name, name_size); if (obj) { grn_rc rc = grn_obj_remove_flags(ctx, obj, flags); if (rc == GRN_SUCCESS) { GRN_API_RETURN(rc); } if (!(flags & GRN_OBJ_REMOVE_ENSURE)) { GRN_API_RETURN(rc); } } ... ``` So, this changes API does not affect. --- `grn_obj_remove_flags()` is used in `grn_ctx_remove_by_id_internal()` However, `grn_obj_remove_flags()` is not called when `obj` is `NULL` as below. ```c grn_obj *obj = grn_ctx_at(ctx, id); if (obj) { grn_rc rc; if (is_top_level) { rc = grn_obj_remove_flags(ctx, obj, flags); } else { rc = grn_obj_remove_internal(ctx, obj, flags); } ``` So, this changes API does not affect.
grn_bulk_fin() may clear header.impl_flags in the future.
…file (groonga#1994) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…ga#1993) Fix the missing DLL error.
…ile (groonga#1995) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…der file (groonga#1997) GitHub: groongaGH-1817 Prepare to switch to documents automatically generated by Doxygen.
…lock() about lock management (groonga#1996)
Because grn_obj_unlink() may return GRN_INVALID_ARGUMENT when error occurs in this function. Also, grn_obj_close() return a value of grn_rc.
komainu8
force-pushed
the
return-grn-rc
branch
from
October 10, 2024 09:24
41d6973
to
ee23eb0
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because grn_obj_unlink() may return GRN_INVALID_ARGUMENT when error occurs in this function.
Also, grn_obj_close() return a value of grn_rc.