Kouhei Sutou
null+****@clear*****
Thu May 12 17:28:26 JST 2016
Kouhei Sutou 2016-05-12 17:28:26 +0900 (Thu, 12 May 2016) New Revision: c99c0c0af61a77f75bf840392f5e9a0559eaea5e https://github.com/groonga/groonga/commit/c99c0c0af61a77f75bf840392f5e9a0559eaea5e Message: hash: add new EACH macros Usage: GRN_HASH_EACH_BEGIN(ctx, hash, cursor, id) { /* ... */ } GRN_HASH_EACH_END(ctx, cursor); It's useful rather than existing EACH macro when you run Groonga on debugger. You can't step execution with existing EACH macro but you can do it with this macro. Modified files: include/groonga/hash.h Modified: include/groonga/hash.h (+14 -0) =================================================================== --- include/groonga/hash.h 2016-05-12 15:22:37 +0900 (36a00bc) +++ include/groonga/hash.h 2016-05-12 17:28:26 +0900 (034f3f7) @@ -84,6 +84,20 @@ GRN_API grn_rc grn_hash_cursor_delete(grn_ctx *ctx, grn_hash_cursor *c, }\ } while (0) +#define GRN_HASH_EACH_BEGIN(ctx, hash, cursor, id) do {\ + grn_hash_cursor *cursor;\ + cursor = grn_hash_cursor_open((ctx), (hash),\ + NULL, 0, NULL, 0,\ + 0, -1, GRN_CURSOR_BY_ID);\ + if (cursor) {\ + grn_id id;\ + while ((id = grn_hash_cursor_next((ctx), cursor)) != GRN_ID_NIL)\ + +#define GRN_HASH_EACH_END(ctx, cursor)\ + grn_hash_cursor_close((ctx), cursor);\ + }\ +} while(0) + #ifdef __cplusplus } #endif -------------- next part -------------- HTML����������������������������... Download