Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/plugins/fts-squat/squat-trie.c @ 7226:e6693a0ec8e1 HEAD
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
replaced them with T_BEGIN/END calls. T_FRAME() made it difficult to debug
code with gdb.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 11 Feb 2008 20:17:00 +0200 |
parents | d5116fa2c88f |
children | 599a9c679ee2 |
comparison
equal
deleted
inserted
replaced
7225:0fe19a3d82a3 | 7226:e6693a0ec8e1 |
---|---|
651 const unsigned int str_len = node->leaf_string_length; | 651 const unsigned int str_len = node->leaf_string_length; |
652 unsigned int i; | 652 unsigned int i; |
653 | 653 |
654 if (data_len != str_len) { | 654 if (data_len != str_len) { |
655 /* different lengths, can't match */ | 655 /* different lengths, can't match */ |
656 T_FRAME( | 656 T_BEGIN { |
657 node_split_string(ctx, node); | 657 node_split_string(ctx, node); |
658 ); | 658 } T_END; |
659 return FALSE; | 659 return FALSE; |
660 } | 660 } |
661 | 661 |
662 for (i = 0; i < data_len; i++) { | 662 for (i = 0; i < data_len; i++) { |
663 if (data[i] != str[i]) { | 663 if (data[i] != str[i]) { |
664 /* non-match */ | 664 /* non-match */ |
665 T_FRAME( | 665 T_BEGIN { |
666 node_split_string(ctx, node); | 666 node_split_string(ctx, node); |
667 ); | 667 } T_END; |
668 return FALSE; | 668 return FALSE; |
669 } | 669 } |
670 } | 670 } |
671 return TRUE; | 671 return TRUE; |
672 } | 672 } |
907 uint32_t uid, enum squat_index_type type, | 907 uint32_t uid, enum squat_index_type type, |
908 const unsigned char *input, unsigned int size) | 908 const unsigned char *input, unsigned int size) |
909 { | 909 { |
910 int ret; | 910 int ret; |
911 | 911 |
912 T_FRAME( | 912 T_BEGIN { |
913 ret = squat_trie_build_more_real(ctx, uid, type, input, size); | 913 ret = squat_trie_build_more_real(ctx, uid, type, input, size); |
914 ); | 914 } T_END; |
915 return ret; | 915 return ret; |
916 } | 916 } |
917 | 917 |
918 static void node_drop_unused_children(struct squat_node *node) | 918 static void node_drop_unused_children(struct squat_node *node) |
919 { | 919 { |
975 trie->hdr.node_count++; | 975 trie->hdr.node_count++; |
976 | 976 |
977 children = NODE_CHILDREN_NODES(node); | 977 children = NODE_CHILDREN_NODES(node); |
978 node_offsets = t_new(uoff_t, child_count); | 978 node_offsets = t_new(uoff_t, child_count); |
979 for (i = 0; i < child_count; i++) { | 979 for (i = 0; i < child_count; i++) { |
980 T_FRAME( | 980 T_BEGIN { |
981 ret = squat_write_node(ctx, &children[i], | 981 ret = squat_write_node(ctx, &children[i], |
982 &node_offsets[i], level + 1); | 982 &node_offsets[i], level + 1); |
983 ); | 983 } T_END; |
984 if (ret < 0) | 984 if (ret < 0) |
985 return -1; | 985 return -1; |
986 } | 986 } |
987 | 987 |
988 *node_offset_r = ctx->output->offset; | 988 *node_offset_r = ctx->output->offset; |
997 int ret; | 997 int ret; |
998 | 998 |
999 if (ctx->trie->root.next_uid == 0) | 999 if (ctx->trie->root.next_uid == 0) |
1000 return 0; | 1000 return 0; |
1001 | 1001 |
1002 T_FRAME( | 1002 T_BEGIN { |
1003 ret = squat_write_node(ctx, &ctx->trie->root, &node_offset, 0); | 1003 ret = squat_write_node(ctx, &ctx->trie->root, &node_offset, 0); |
1004 ); | 1004 } T_END; |
1005 if (ret < 0) | 1005 if (ret < 0) |
1006 return -1; | 1006 return -1; |
1007 | 1007 |
1008 trie->hdr.root_offset = node_offset; | 1008 trie->hdr.root_offset = node_offset; |
1009 trie->hdr.root_unused_uids = trie->root.unused_uids; | 1009 trie->hdr.root_unused_uids = trie->root.unused_uids; |
1935 ARRAY_TYPE(seq_range) *definite_uids, | 1935 ARRAY_TYPE(seq_range) *definite_uids, |
1936 ARRAY_TYPE(seq_range) *maybe_uids) | 1936 ARRAY_TYPE(seq_range) *maybe_uids) |
1937 { | 1937 { |
1938 int ret; | 1938 int ret; |
1939 | 1939 |
1940 T_FRAME( | 1940 T_BEGIN { |
1941 ret = squat_trie_lookup_real(trie, str, type, | 1941 ret = squat_trie_lookup_real(trie, str, type, |
1942 definite_uids, maybe_uids); | 1942 definite_uids, maybe_uids); |
1943 ); | 1943 } T_END; |
1944 return ret; | 1944 return ret; |
1945 } | 1945 } |
1946 | 1946 |
1947 struct squat_uidlist *squat_trie_get_uidlist(struct squat_trie *trie) | 1947 struct squat_uidlist *squat_trie_get_uidlist(struct squat_trie *trie) |
1948 { | 1948 { |