diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-06-03 08:19:32 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-06-03 08:19:32 +0000 |
commit | 1248a0dc1fe970951fdba063b88d8ad8c96db912 (patch) | |
tree | 1d544c2bf20d01eb4861b82df78f4a9ed904840a /apps/tagcache.c | |
parent | 2bedde17b6d841ee8910a71cf5343ec8c8fed98b (diff) | |
download | rockbox-1248a0dc1fe970951fdba063b88d8ad8c96db912.tar.gz rockbox-1248a0dc1fe970951fdba063b88d8ad8c96db912.zip |
Replace arrays of tags that are numeric/sorted/uniqued with bitfields flagging each tag that is a member of the set, and replace the membership tests with a shift and bitwise and. The test is still done inside a function on SH, as this saves some space vs the macro used on other targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21175 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r-- | apps/tagcache.c | 124 |
1 files changed, 52 insertions, 72 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 055f439446..4a542fb702 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -107,21 +107,24 @@ static long tempbuf_size; /* Buffer size (TEMPBUF_SIZE). */ | |||
107 | static long tempbuf_left; /* Buffer space left. */ | 107 | static long tempbuf_left; /* Buffer space left. */ |
108 | static long tempbuf_pos; | 108 | static long tempbuf_pos; |
109 | 109 | ||
110 | #ifdef CPU_SH | ||
111 | #define TAGCACHE_IS_UNIQUE(tag) (tagcache_is_unique_tag(tag)) | ||
112 | #define TAGCACHE_IS_SORTED(tag) (tagcache_is_sorted_tag(tag)) | ||
113 | #else | ||
114 | #define TAGCACHE_IS_UNIQUE(tag) ((1LU << tag) & TAGCACHE_UNIQUE_TAGS) | ||
115 | #define TAGCACHE_IS_SORTED(tag) ((1LU << tag) & TAGCACHE_SORTED_TAGS) | ||
116 | #endif | ||
117 | |||
110 | /* Tags we want to get sorted (loaded to the tempbuf). */ | 118 | /* Tags we want to get sorted (loaded to the tempbuf). */ |
111 | static const int sorted_tags[] = { tag_artist, tag_album, tag_genre, | 119 | #define TAGCACHE_SORTED_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ |
112 | tag_composer, tag_comment, tag_albumartist, tag_grouping, tag_title }; | 120 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ |
121 | (1LU << tag_albumartist) | (1LU << tag_grouping) | (1LU << tag_title)) | ||
122 | #define SORTED_TAGS_COUNT 8 | ||
113 | 123 | ||
114 | /* Uniqued tags (we can use these tags with filters and conditional clauses). */ | 124 | /* Uniqued tags (we can use these tags with filters and conditional clauses). */ |
115 | static const int unique_tags[] = { tag_artist, tag_album, tag_genre, | 125 | #define TAGCACHE_UNIQUE_TAGS ((1LU << tag_artist) | (1LU << tag_album) | \ |
116 | tag_composer, tag_comment, tag_albumartist, tag_grouping }; | 126 | (1LU << tag_genre) | (1LU << tag_composer) | (1LU << tag_comment) | \ |
117 | 127 | (1LU << tag_albumartist) | (1LU << tag_grouping)) | |
118 | /* Numeric tags (we can use these tags with conditional clauses). */ | ||
119 | static const int numeric_tags[] = { tag_year, tag_discnumber, | ||
120 | tag_tracknumber, tag_length, tag_bitrate, tag_playcount, tag_rating, | ||
121 | tag_playtime, tag_lastplayed, tag_commitid, tag_mtime, | ||
122 | tag_virt_length_min, tag_virt_length_sec, | ||
123 | tag_virt_playtime_min, tag_virt_playtime_sec, | ||
124 | tag_virt_entryage, tag_virt_autoscore }; | ||
125 | 128 | ||
126 | /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ | 129 | /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ |
127 | static const char *tags_str[] = { "artist", "album", "genre", "title", | 130 | static const char *tags_str[] = { "artist", "album", "genre", "title", |
@@ -265,44 +268,22 @@ const char* tagcache_tag_to_str(int tag) | |||
265 | return tags_str[tag]; | 268 | return tags_str[tag]; |
266 | } | 269 | } |
267 | 270 | ||
271 | #ifdef CPU_SH | ||
268 | bool tagcache_is_numeric_tag(int type) | 272 | bool tagcache_is_numeric_tag(int type) |
269 | { | 273 | { |
270 | int i; | 274 | return (1LU << type) & TAGCACHE_NUMERIC_TAGS; |
271 | |||
272 | for (i = 0; i < (int)(sizeof(numeric_tags)/sizeof(numeric_tags[0])); i++) | ||
273 | { | ||
274 | if (type == numeric_tags[i]) | ||
275 | return true; | ||
276 | } | ||
277 | |||
278 | return false; | ||
279 | } | 275 | } |
280 | 276 | ||
281 | bool tagcache_is_unique_tag(int type) | 277 | static bool tagcache_is_unique_tag(int type) |
282 | { | 278 | { |
283 | int i; | 279 | return (1LU << type) & TAGCACHE_UNIQUE_TAGS; |
284 | |||
285 | for (i = 0; i < (int)(sizeof(unique_tags)/sizeof(unique_tags[0])); i++) | ||
286 | { | ||
287 | if (type == unique_tags[i]) | ||
288 | return true; | ||
289 | } | ||
290 | |||
291 | return false; | ||
292 | } | 280 | } |
293 | 281 | ||
294 | bool tagcache_is_sorted_tag(int type) | 282 | static bool tagcache_is_sorted_tag(int type) |
295 | { | 283 | { |
296 | int i; | 284 | return (1LU << type) & TAGCACHE_UNIQUE_TAGS; |
297 | |||
298 | for (i = 0; i < (int)(sizeof(sorted_tags)/sizeof(sorted_tags[0])); i++) | ||
299 | { | ||
300 | if (type == sorted_tags[i]) | ||
301 | return true; | ||
302 | } | ||
303 | |||
304 | return false; | ||
305 | } | 285 | } |
286 | #endif | ||
306 | 287 | ||
307 | #ifdef HAVE_DIRCACHE | 288 | #ifdef HAVE_DIRCACHE |
308 | /** | 289 | /** |
@@ -321,7 +302,7 @@ static int open_tag_fd(struct tagcache_header *hdr, int tag, bool write) | |||
321 | char buf[MAX_PATH]; | 302 | char buf[MAX_PATH]; |
322 | int rc; | 303 | int rc; |
323 | 304 | ||
324 | if (tagcache_is_numeric_tag(tag) || tag < 0 || tag >= TAG_COUNT) | 305 | if (TAGCACHE_IS_NUMERIC(tag) || tag < 0 || tag >= TAG_COUNT) |
325 | return -1; | 306 | return -1; |
326 | 307 | ||
327 | snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, tag); | 308 | snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, tag); |
@@ -654,7 +635,7 @@ static bool write_index(int masterfd, int idxid, struct index_entry *idx) | |||
654 | 635 | ||
655 | for (tag = 0; tag < TAG_COUNT; tag++) | 636 | for (tag = 0; tag < TAG_COUNT; tag++) |
656 | { | 637 | { |
657 | if (tagcache_is_numeric_tag(tag)) | 638 | if (TAGCACHE_IS_NUMERIC(tag)) |
658 | { | 639 | { |
659 | idx_ram->tag_seek[tag] = idx->tag_seek[tag]; | 640 | idx_ram->tag_seek[tag] = idx->tag_seek[tag]; |
660 | } | 641 | } |
@@ -708,7 +689,7 @@ static bool retrieve(struct tagcache_search *tcs, struct index_entry *idx, | |||
708 | 689 | ||
709 | *buf = '\0'; | 690 | *buf = '\0'; |
710 | 691 | ||
711 | if (tagcache_is_numeric_tag(tag)) | 692 | if (TAGCACHE_IS_NUMERIC(tag)) |
712 | return false; | 693 | return false; |
713 | 694 | ||
714 | seek = idx->tag_seek[tag]; | 695 | seek = idx->tag_seek[tag]; |
@@ -827,7 +808,7 @@ long tagcache_get_numeric(const struct tagcache_search *tcs, int tag) | |||
827 | if (!tc_stat.ready) | 808 | if (!tc_stat.ready) |
828 | return false; | 809 | return false; |
829 | 810 | ||
830 | if (!tagcache_is_numeric_tag(tag)) | 811 | if (!TAGCACHE_IS_NUMERIC(tag)) |
831 | return -1; | 812 | return -1; |
832 | 813 | ||
833 | if (!get_index(tcs->masterfd, tcs->idx_id, &idx, true)) | 814 | if (!get_index(tcs->masterfd, tcs->idx_id, &idx, true)) |
@@ -945,7 +926,7 @@ static bool check_clauses(struct tagcache_search *tcs, | |||
945 | 926 | ||
946 | seek = check_virtual_tags(clause[i]->tag, idx); | 927 | seek = check_virtual_tags(clause[i]->tag, idx); |
947 | 928 | ||
948 | if (!tagcache_is_numeric_tag(clause[i]->tag)) | 929 | if (!TAGCACHE_IS_NUMERIC(clause[i]->tag)) |
949 | { | 930 | { |
950 | if (clause[i]->tag == tag_filename) | 931 | if (clause[i]->tag == tag_filename) |
951 | { | 932 | { |
@@ -976,7 +957,7 @@ static bool check_clauses(struct tagcache_search *tcs, | |||
976 | seek = check_virtual_tags(clause[i]->tag, idx); | 957 | seek = check_virtual_tags(clause[i]->tag, idx); |
977 | 958 | ||
978 | memset(str, 0, sizeof str); | 959 | memset(str, 0, sizeof str); |
979 | if (!tagcache_is_numeric_tag(clause[i]->tag)) | 960 | if (!TAGCACHE_IS_NUMERIC(clause[i]->tag)) |
980 | { | 961 | { |
981 | int fd = tcs->idxfd[clause[i]->tag]; | 962 | int fd = tcs->idxfd[clause[i]->tag]; |
982 | lseek(fd, seek, SEEK_SET); | 963 | lseek(fd, seek, SEEK_SET); |
@@ -1021,9 +1002,8 @@ static bool add_uniqbuf(struct tagcache_search *tcs, unsigned long id) | |||
1021 | int i; | 1002 | int i; |
1022 | 1003 | ||
1023 | /* If uniq buffer is not defined we must return true for search to work. */ | 1004 | /* If uniq buffer is not defined we must return true for search to work. */ |
1024 | if (tcs->unique_list == NULL | 1005 | if (tcs->unique_list == NULL || (!TAGCACHE_IS_UNIQUE(tcs->type) |
1025 | || (!tagcache_is_unique_tag(tcs->type) | 1006 | && !TAGCACHE_IS_NUMERIC(tcs->type))) |
1026 | && !tagcache_is_numeric_tag(tcs->type))) | ||
1027 | { | 1007 | { |
1028 | return true; | 1008 | return true; |
1029 | } | 1009 | } |
@@ -1154,7 +1134,7 @@ static void remove_files(void) | |||
1154 | remove(TAGCACHE_FILE_MASTER); | 1134 | remove(TAGCACHE_FILE_MASTER); |
1155 | for (i = 0; i < TAG_COUNT; i++) | 1135 | for (i = 0; i < TAG_COUNT; i++) |
1156 | { | 1136 | { |
1157 | if (tagcache_is_numeric_tag(i)) | 1137 | if (TAGCACHE_IS_NUMERIC(i)) |
1158 | continue; | 1138 | continue; |
1159 | 1139 | ||
1160 | snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, i); | 1140 | snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, i); |
@@ -1184,7 +1164,7 @@ static bool check_all_headers(void) | |||
1184 | 1164 | ||
1185 | for (tag = 0; tag < TAG_COUNT; tag++) | 1165 | for (tag = 0; tag < TAG_COUNT; tag++) |
1186 | { | 1166 | { |
1187 | if (tagcache_is_numeric_tag(tag)) | 1167 | if (TAGCACHE_IS_NUMERIC(tag)) |
1188 | continue; | 1168 | continue; |
1189 | 1169 | ||
1190 | if ( (fd = open_tag_fd(&tch, tag, false)) < 0) | 1170 | if ( (fd = open_tag_fd(&tch, tag, false)) < 0) |
@@ -1233,7 +1213,7 @@ bool tagcache_search(struct tagcache_search *tcs, int tag) | |||
1233 | else | 1213 | else |
1234 | #endif | 1214 | #endif |
1235 | { | 1215 | { |
1236 | if (!tagcache_is_numeric_tag(tcs->type)) | 1216 | if (!TAGCACHE_IS_NUMERIC(tcs->type)) |
1237 | { | 1217 | { |
1238 | tcs->idxfd[tcs->type] = open_tag_fd(&tag_hdr, tcs->type, false); | 1218 | tcs->idxfd[tcs->type] = open_tag_fd(&tag_hdr, tcs->type, false); |
1239 | if (tcs->idxfd[tcs->type] < 0) | 1219 | if (tcs->idxfd[tcs->type] < 0) |
@@ -1269,7 +1249,7 @@ bool tagcache_search_add_filter(struct tagcache_search *tcs, | |||
1269 | if (tcs->filter_count == TAGCACHE_MAX_FILTERS) | 1249 | if (tcs->filter_count == TAGCACHE_MAX_FILTERS) |
1270 | return false; | 1250 | return false; |
1271 | 1251 | ||
1272 | if (!tagcache_is_unique_tag(tag) || tagcache_is_numeric_tag(tag)) | 1252 | if (!TAGCACHE_IS_UNIQUE(tag) || TAGCACHE_IS_NUMERIC(tag)) |
1273 | return false; | 1253 | return false; |
1274 | 1254 | ||
1275 | tcs->filter_tag[tcs->filter_count] = tag; | 1255 | tcs->filter_tag[tcs->filter_count] = tag; |
@@ -1299,7 +1279,7 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs, | |||
1299 | return true; | 1279 | return true; |
1300 | } | 1280 | } |
1301 | 1281 | ||
1302 | if (!tagcache_is_numeric_tag(clause->tag) && tcs->idxfd[clause->tag] < 0) | 1282 | if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0) |
1303 | { | 1283 | { |
1304 | char buf[MAX_PATH]; | 1284 | char buf[MAX_PATH]; |
1305 | 1285 | ||
@@ -1330,7 +1310,7 @@ static bool get_next(struct tagcache_search *tcs) | |||
1330 | if (!tcs->valid || !tc_stat.ready) | 1310 | if (!tcs->valid || !tc_stat.ready) |
1331 | return false; | 1311 | return false; |
1332 | 1312 | ||
1333 | if (tcs->idxfd[tcs->type] < 0 && !tagcache_is_numeric_tag(tcs->type) | 1313 | if (tcs->idxfd[tcs->type] < 0 && !TAGCACHE_IS_NUMERIC(tcs->type) |
1334 | #ifdef HAVE_TC_RAMCACHE | 1314 | #ifdef HAVE_TC_RAMCACHE |
1335 | && !tcs->ramsearch | 1315 | && !tcs->ramsearch |
1336 | #endif | 1316 | #endif |
@@ -1339,7 +1319,7 @@ static bool get_next(struct tagcache_search *tcs) | |||
1339 | 1319 | ||
1340 | /* Relative fetch. */ | 1320 | /* Relative fetch. */ |
1341 | if (tcs->filter_count > 0 || tcs->clause_count > 0 | 1321 | if (tcs->filter_count > 0 || tcs->clause_count > 0 |
1342 | || tagcache_is_numeric_tag(tcs->type)) | 1322 | || TAGCACHE_IS_NUMERIC(tcs->type)) |
1343 | { | 1323 | { |
1344 | /* Check for end of list. */ | 1324 | /* Check for end of list. */ |
1345 | if (tcs->seek_list_count == 0) | 1325 | if (tcs->seek_list_count == 0) |
@@ -1357,7 +1337,7 @@ static bool get_next(struct tagcache_search *tcs) | |||
1357 | 1337 | ||
1358 | /* Seek stream to the correct position and continue to direct fetch. */ | 1338 | /* Seek stream to the correct position and continue to direct fetch. */ |
1359 | if ((!tcs->ramsearch || !TAG_FILENAME_RAM(tcs)) | 1339 | if ((!tcs->ramsearch || !TAG_FILENAME_RAM(tcs)) |
1360 | && !tagcache_is_numeric_tag(tcs->type)) | 1340 | && !TAGCACHE_IS_NUMERIC(tcs->type)) |
1361 | { | 1341 | { |
1362 | if (!open_files(tcs, tcs->type)) | 1342 | if (!open_files(tcs, tcs->type)) |
1363 | return false; | 1343 | return false; |
@@ -1368,7 +1348,7 @@ static bool get_next(struct tagcache_search *tcs) | |||
1368 | tcs->position = tcs->seek_list[tcs->seek_list_count]; | 1348 | tcs->position = tcs->seek_list[tcs->seek_list_count]; |
1369 | } | 1349 | } |
1370 | 1350 | ||
1371 | if (tagcache_is_numeric_tag(tcs->type)) | 1351 | if (TAGCACHE_IS_NUMERIC(tcs->type)) |
1372 | { | 1352 | { |
1373 | snprintf(buf, sizeof(buf), "%d", tcs->position); | 1353 | snprintf(buf, sizeof(buf), "%d", tcs->position); |
1374 | tcs->result_seek = tcs->position; | 1354 | tcs->result_seek = tcs->position; |
@@ -2257,7 +2237,7 @@ static bool build_numeric_indices(struct tagcache_header *h, int tmpfd) | |||
2257 | 2237 | ||
2258 | for (j = 0; j < TAG_COUNT; j++) | 2238 | for (j = 0; j < TAG_COUNT; j++) |
2259 | { | 2239 | { |
2260 | if (!tagcache_is_numeric_tag(j)) | 2240 | if (!TAGCACHE_IS_NUMERIC(j)) |
2261 | continue; | 2241 | continue; |
2262 | 2242 | ||
2263 | idx.tag_seek[j] = entrybuf[i].tag_offset[j]; | 2243 | idx.tag_seek[j] = entrybuf[i].tag_offset[j]; |
@@ -2395,7 +2375,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
2395 | * it entirely into memory so we can resort it later for use with | 2375 | * it entirely into memory so we can resort it later for use with |
2396 | * chunked browsing. | 2376 | * chunked browsing. |
2397 | */ | 2377 | */ |
2398 | if (tagcache_is_sorted_tag(index_type)) | 2378 | if (TAGCACHE_IS_SORTED(index_type)) |
2399 | { | 2379 | { |
2400 | logf("loading tags..."); | 2380 | logf("loading tags..."); |
2401 | for (i = 0; i < tch.entry_count; i++) | 2381 | for (i = 0; i < tch.entry_count; i++) |
@@ -2437,7 +2417,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
2437 | */ | 2417 | */ |
2438 | ret = tempbuf_insert(buf, loc/TAGFILE_ENTRY_CHUNK_LENGTH | 2418 | ret = tempbuf_insert(buf, loc/TAGFILE_ENTRY_CHUNK_LENGTH |
2439 | + commit_entry_count, entry.idx_id, | 2419 | + commit_entry_count, entry.idx_id, |
2440 | tagcache_is_unique_tag(index_type)); | 2420 | TAGCACHE_IS_UNIQUE(index_type)); |
2441 | if (!ret) | 2421 | if (!ret) |
2442 | { | 2422 | { |
2443 | close(fd); | 2423 | close(fd); |
@@ -2540,7 +2520,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
2540 | * Load new unique tags in memory to be sorted later and added | 2520 | * Load new unique tags in memory to be sorted later and added |
2541 | * to the master lookup file. | 2521 | * to the master lookup file. |
2542 | */ | 2522 | */ |
2543 | if (tagcache_is_sorted_tag(index_type)) | 2523 | if (TAGCACHE_IS_SORTED(index_type)) |
2544 | { | 2524 | { |
2545 | lseek(tmpfd, sizeof(struct tagcache_header), SEEK_SET); | 2525 | lseek(tmpfd, sizeof(struct tagcache_header), SEEK_SET); |
2546 | /* h is the header of the temporary file containing new tags. */ | 2526 | /* h is the header of the temporary file containing new tags. */ |
@@ -2574,7 +2554,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
2574 | goto error_exit; | 2554 | goto error_exit; |
2575 | } | 2555 | } |
2576 | 2556 | ||
2577 | if (tagcache_is_unique_tag(index_type)) | 2557 | if (TAGCACHE_IS_UNIQUE(index_type)) |
2578 | error = !tempbuf_insert(buf, i, -1, true); | 2558 | error = !tempbuf_insert(buf, i, -1, true); |
2579 | else | 2559 | else |
2580 | error = !tempbuf_insert(buf, i, tcmh.tch.entry_count + i, false); | 2560 | error = !tempbuf_insert(buf, i, tcmh.tch.entry_count + i, false); |
@@ -2691,7 +2671,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
2691 | /* Read entry headers. */ | 2671 | /* Read entry headers. */ |
2692 | for (j = 0; j < idxbuf_pos; j++) | 2672 | for (j = 0; j < idxbuf_pos; j++) |
2693 | { | 2673 | { |
2694 | if (!tagcache_is_sorted_tag(index_type)) | 2674 | if (!TAGCACHE_IS_SORTED(index_type)) |
2695 | { | 2675 | { |
2696 | struct temp_file_entry entry; | 2676 | struct temp_file_entry entry; |
2697 | struct tagfile_entry fe; | 2677 | struct tagfile_entry fe; |
@@ -2893,7 +2873,7 @@ static bool commit(void) | |||
2893 | { | 2873 | { |
2894 | int ret; | 2874 | int ret; |
2895 | 2875 | ||
2896 | if (tagcache_is_numeric_tag(i)) | 2876 | if (TAGCACHE_IS_NUMERIC(i)) |
2897 | continue; | 2877 | continue; |
2898 | 2878 | ||
2899 | tc_stat.commit_step++; | 2879 | tc_stat.commit_step++; |
@@ -3006,7 +2986,7 @@ static bool modify_numeric_entry(int masterfd, int idx_id, int tag, long data) | |||
3006 | if (!tc_stat.ready) | 2986 | if (!tc_stat.ready) |
3007 | return false; | 2987 | return false; |
3008 | 2988 | ||
3009 | if (!tagcache_is_numeric_tag(tag)) | 2989 | if (!TAGCACHE_IS_NUMERIC(tag)) |
3010 | return false; | 2990 | return false; |
3011 | 2991 | ||
3012 | if (!get_index(masterfd, idx_id, &idx, false)) | 2992 | if (!get_index(masterfd, idx_id, &idx, false)) |
@@ -3443,7 +3423,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) | |||
3443 | /* Now retrieve all tags. */ | 3423 | /* Now retrieve all tags. */ |
3444 | for (j = 0; j < TAG_COUNT; j++) | 3424 | for (j = 0; j < TAG_COUNT; j++) |
3445 | { | 3425 | { |
3446 | if (tagcache_is_numeric_tag(j)) | 3426 | if (TAGCACHE_IS_NUMERIC(j)) |
3447 | { | 3427 | { |
3448 | snprintf(temp, sizeof temp, "%d", idx.tag_seek[j]); | 3428 | snprintf(temp, sizeof temp, "%d", idx.tag_seek[j]); |
3449 | write_tag(clfd, tagcache_tag_to_str(j), temp); | 3429 | write_tag(clfd, tagcache_tag_to_str(j), temp); |
@@ -3540,7 +3520,7 @@ static bool delete_entry(long idx_id) | |||
3540 | 3520 | ||
3541 | for (tag = 0; tag < TAG_COUNT; tag++) | 3521 | for (tag = 0; tag < TAG_COUNT; tag++) |
3542 | { | 3522 | { |
3543 | if (tagcache_is_numeric_tag(tag)) | 3523 | if (TAGCACHE_IS_NUMERIC(tag)) |
3544 | continue; | 3524 | continue; |
3545 | 3525 | ||
3546 | if (idxp->tag_seek[tag] == myidx.tag_seek[tag]) | 3526 | if (idxp->tag_seek[tag] == myidx.tag_seek[tag]) |
@@ -3554,7 +3534,7 @@ static bool delete_entry(long idx_id) | |||
3554 | struct tagcache_header tch; | 3534 | struct tagcache_header tch; |
3555 | int oldseek = myidx.tag_seek[tag]; | 3535 | int oldseek = myidx.tag_seek[tag]; |
3556 | 3536 | ||
3557 | if (tagcache_is_numeric_tag(tag)) | 3537 | if (TAGCACHE_IS_NUMERIC(tag)) |
3558 | continue; | 3538 | continue; |
3559 | 3539 | ||
3560 | /** | 3540 | /** |
@@ -3866,7 +3846,7 @@ static bool load_tagcache(void) | |||
3866 | struct tagfile_entry *fe; | 3846 | struct tagfile_entry *fe; |
3867 | char buf[TAG_MAXLEN+32]; | 3847 | char buf[TAG_MAXLEN+32]; |
3868 | 3848 | ||
3869 | if (tagcache_is_numeric_tag(tag)) | 3849 | if (TAGCACHE_IS_NUMERIC(tag)) |
3870 | continue ; | 3850 | continue ; |
3871 | 3851 | ||
3872 | //p = ((void *)p+1); | 3852 | //p = ((void *)p+1); |
@@ -4538,6 +4518,6 @@ int tagcache_get_commit_step(void) | |||
4538 | } | 4518 | } |
4539 | int tagcache_get_max_commit_step(void) | 4519 | int tagcache_get_max_commit_step(void) |
4540 | { | 4520 | { |
4541 | return (int)(sizeof(sorted_tags)/sizeof(sorted_tags[0]))+1; | 4521 | return (int)(SORTED_TAGS_COUNT)+1; |
4542 | } | 4522 | } |
4543 | 4523 | ||