From d60ceb1207929799c672fbe52fdafe64dc38ae6c Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 31 May 2011 14:05:31 -0400 Subject: [PATCH] Define a consistent way to turn message id into thread id hash --- webcit/blogview_renderer.c | 4 ++-- webcit/webcit.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webcit/blogview_renderer.c b/webcit/blogview_renderer.c index 1320c5497..9c66093c8 100644 --- a/webcit/blogview_renderer.c +++ b/webcit/blogview_renderer.c @@ -146,12 +146,12 @@ struct bltr blogview_learn_thread_references(long msgnum) { if (!strncasecmp(ChrPtr(Buf), "msgn=", 5)) { StrBufCutLeft(Buf, 5); - bltr.id = abs(HashLittle(ChrPtr(Buf), StrLength(Buf))); + bltr.id = ThreadIdHash(Buf); } else if (!strncasecmp(ChrPtr(Buf), "wefw=", 5)) { StrBufCutLeft(Buf, 5); /* trim the field name */ StrBufExtract_token(r, Buf, 0, '|'); - bltr.refs = abs(HashLittle(ChrPtr(r), StrLength(r))); + bltr.refs = ThreadIdHash(r); } } } diff --git a/webcit/webcit.h b/webcit/webcit.h index 022ed2d83..ccd2b779d 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -887,6 +887,9 @@ void http_datestring(char *buf, size_t n, time_t xtime); extern int time_to_die; /* Nonzero if server is shutting down */ +/* a nice consistent place to define how we turn a message id into a thread id hash */ +#define ThreadIdHash(Buf) abs(HashLittle(ChrPtr(Buf), StrLength(Buf))) + /* * Array type for a blog post. The first message is the post; the rest are comments */ -- 2.30.2