[982] in BarnOwl Developers
[D-O-H] r968 - branches/barnowl_sqlite/owl
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:11:50 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Mon, 25 Feb 2008 12:47:23 -0500 (EST)
Author: nelhage
Date: 2008-02-25 12:47:22 -0500 (Mon, 25 Feb 2008)
New Revision: 968
Modified:
branches/barnowl_sqlite/owl/global.c
branches/barnowl_sqlite/owl/message.c
branches/barnowl_sqlite/owl/messagelist.c
branches/barnowl_sqlite/owl/owl.h
Log:
Fix invalidating all fmtexts to
a) work, and
b) not be O(n)
Modified: branches/barnowl_sqlite/owl/global.c
===================================================================
--- branches/barnowl_sqlite/owl/global.c 2008-02-25 05:29:47 UTC (rev 967)
+++ branches/barnowl_sqlite/owl/global.c 2008-02-25 17:47:22 UTC (rev 968)
@@ -115,6 +115,8 @@
owl_message_init_fmtext_cache();
owl_list_create(&(g->dispatchlist));
+
+ g->fmtext_seq = 0;
}
void _owl_global_setup_windows(owl_global *g) {
@@ -943,3 +945,13 @@
{
return &(g->dispatchlist);
}
+
+int owl_global_get_fmtext_seq(owl_global *g)
+{
+ return g->fmtext_seq;
+}
+
+void owl_global_next_fmtext_seq(owl_global *g)
+{
+ g->fmtext_seq++;
+}
Modified: branches/barnowl_sqlite/owl/message.c
===================================================================
--- branches/barnowl_sqlite/owl/message.c 2008-02-25 05:29:47 UTC (rev 967)
+++ branches/barnowl_sqlite/owl/message.c 2008-02-25 17:47:22 UTC (rev 968)
@@ -22,7 +22,6 @@
void owl_message_init(owl_message *m)
{
-
}
SV* owl_message_get_attribute_internal(owl_message *m, char *attrname)
@@ -960,6 +959,7 @@
fmtext_cache_next = fmtext_cache;
owl_fmtext_clear(&(f->fmtext));
f->message_id = NO_MESSAGE;
+ f->seq = owl_global_get_fmtext_seq(&g);
return f;
}
@@ -1007,7 +1007,9 @@
fm = owl_message_get_fmtext_cache(m);
- if (!fm || fm->message_id != owl_message_get_id(m)) {
+ if (!fm
+ || fm->message_id != owl_message_get_id(m)
+ || fm->seq != owl_global_get_fmtext_seq(&g)) {
fm = owl_message_next_fmtext();
owl_message_set_fmtext_cache(m, fm);
fm->message_id = owl_message_get_id(m);
Modified: branches/barnowl_sqlite/owl/messagelist.c
===================================================================
--- branches/barnowl_sqlite/owl/messagelist.c 2008-02-25 05:29:47 UTC (rev 967)
+++ branches/barnowl_sqlite/owl/messagelist.c 2008-02-25 17:47:22 UTC (rev 968)
@@ -86,11 +86,5 @@
void owl_messagelist_invalidate_formats(owl_messagelist *ml)
{
- owl_message *m;
-
- owl_messagelist_start_iterate(ml);
-
- while((m = owl_messagelist_iterate_next(ml)) != NULL) {
- owl_message_invalidate_format(m);
- }
+ owl_global_next_fmtext_seq(&g);
}
Modified: branches/barnowl_sqlite/owl/owl.h
===================================================================
--- branches/barnowl_sqlite/owl/owl.h 2008-02-25 05:29:47 UTC (rev 967)
+++ branches/barnowl_sqlite/owl/owl.h 2008-02-25 17:47:22 UTC (rev 968)
@@ -347,8 +347,9 @@
/* We cache the saved fmtexts for the last bunch of messages we
rendered */
typedef struct _owl_fmtext_cache {
- int message_id;
- owl_fmtext fmtext;
+ int message_id;
+ int seq;
+ owl_fmtext fmtext;
} owl_fmtext_cache;
typedef struct _owl_style {
@@ -609,7 +610,8 @@
struct termios startup_tio;
owl_obarray obarray;
owl_list dispatchlist;
-} owl_global;
+ int fmtext_seq; /* Used to invalidate message fmtext caches */
+ } owl_global;
/* globals */
extern owl_global g;