diff options
author | NotZed <NotZed@HelixCode.com> | 2000-05-05 11:46:07 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-05-05 11:46:07 +0800 |
commit | 214c9105509631c39c4d9b60572ee32f0d6d7ea3 (patch) | |
tree | 611b14c8989668df11fa2c714ff13675e1406f3f /camel/camel-folder-summary.c | |
parent | 241a35c42fc0e5287b25bc4980415b0e1e61f422 (diff) | |
download | gsoc2013-evolution-214c9105509631c39c4d9b60572ee32f0d6d7ea3.tar.gz gsoc2013-evolution-214c9105509631c39c4d9b60572ee32f0d6d7ea3.tar.zst gsoc2013-evolution-214c9105509631c39c4d9b60572ee32f0d6d7ea3.zip |
Maxcount is minimum of the max and the requested count, not the maximum :)
2000-05-04 NotZed <NotZed@HelixCode.com>
* providers/mbox/camel-mbox-folder.c (summary_get_message_info):
Maxcount is minimum of the max and the requested count, not the
maximum :)
* camel-mime-parser.c (folder_scan_content): Properly set midline,
so we dont falsely catch offset boundary markers (i.e. From inside
content).
(folder_read): Set a sentinal on the end of the read data (\n) so
we dont have to check the buffer boundary in the inner loop.
(mempool_*): New experimental memory management routines, speed
up simple structure parsing by about 25% ... not compiled in by
default. Something similar may be needed for camel-mime-utils to
address performance issues with g_malloc and friends.
* camel-mime-utils.c: Added a macro w(x) used to wrap all warnings
about mime/rfc violations, so they can be turned off.
* camel-folder-summary.c (summary_build_content_info): Step after
the end of a message ...
Turn into a stand-alone program for testing and profiling.
svn path=/trunk/; revision=2808
Diffstat (limited to 'camel/camel-folder-summary.c')
-rw-r--r-- | camel/camel-folder-summary.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index c54100375f..bb3857ee39 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -1028,7 +1028,8 @@ summary_build_content_info(CamelFolderSummary *s, CamelMimeParser *mp) } else { g_error("Parsing failed: no content of a message?"); } - if (!(state == HSCAN_MESSAGE_END)) { + state = camel_mime_parser_step(mp, &buffer, &len); + if (state != HSCAN_MESSAGE_END) { g_error("Bad parser state: Expecing MESSAGE_END or MESSAGE_EOF, got: %d", state); camel_mime_parser_unstep(mp); } @@ -1039,3 +1040,66 @@ summary_build_content_info(CamelFolderSummary *s, CamelMimeParser *mp) return info; } + +#if 1 +int main(int argc, char **argv) +{ + CamelMimeParser *mp; + int fd; + CamelFolderSummary *s; + char *buffer; + int len; + extern int strdup_count, malloc_count, free_count; + + gtk_init(&argc, &argv); + +#if 0 + { + int i; + char *s; + char buf[1024]; + + for (i=0;i<434712;i++) { + memcpy(buf, " ", 50); + buf[50] = 0; +#if 0 + s = g_strdup(buf); + g_free(s); +#endif + } + return 0; + } +#endif + + if (argc < 2 ) { + printf("usage: %s mbox\n", argv[0]); + return 1; + } + + fd = open(argv[1], O_RDONLY); + + mp = camel_mime_parser_new(); + camel_mime_parser_scan_from(mp, TRUE); +/* camel_mime_parser_set_header_regex(mp, "^(content-[^:]*|subject|from|to|date):");*/ + camel_mime_parser_init_with_fd(mp, fd); + + s = camel_folder_summary_new(); + camel_folder_summary_set_build_content(s, TRUE); + + while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM) { + /*printf("Parsing message ...\n");*/ + camel_folder_summary_add_from_parser(s, mp); + if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM_END) { + g_warning("Uknown state encountered, excpecting %d, got %d\n", HSCAN_FROM_END, camel_mime_parser_state(mp)); + break; + } + } + printf("summarised %d messages\n", camel_folder_summary_count(s)); + + printf("g_strdup count = %d\n", strdup_count); + printf("g_malloc count = %d\n", malloc_count); + printf("g_free count = %d\n", free_count); + return 0; +} + +#endif |