From: Art Cancro Date: Tue, 12 Oct 2010 21:43:52 +0000 (-0400) Subject: Ok, *this* is the way we want it structured internally. X-Git-Tag: v8.01~667 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=971438b20606cb38659b6563f8988720c2f6b18f Ok, *this* is the way we want it structured internally. Now it's time to refactor it to O(N) instead of O(n log n) --- diff --git a/webcit/blogview_renderer.c b/webcit/blogview_renderer.c index d4f1ee4a9..8dc7036e5 100644 --- a/webcit/blogview_renderer.c +++ b/webcit/blogview_renderer.c @@ -121,7 +121,9 @@ int blogview_sortfunc(const void *s1, const void *s2) { void blogview_learn_thread_references(struct blogpost *bp) { StrBuf *Buf; + StrBuf *r; Buf = NewStrBuf(); + r = NewStrBuf(); serv_printf("MSG0 %ld|1", bp->msgnum); /* top level citadel headers only */ StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 1) { @@ -134,14 +136,15 @@ void blogview_learn_thread_references(struct blogpost *bp) else if (!strncasecmp(ChrPtr(Buf), "wefw=", 5)) { StrBufCutLeft(Buf, 5); /* trim the field name */ wc_printf("refs %s, ", ChrPtr(Buf)); - StrBufCutAt(Buf, 0, "|"); /* trim all but the first thread ref */ - wc_printf("topref %s, ", ChrPtr(Buf)); - bp->refs = HashLittle(ChrPtr(Buf), StrLength(Buf)); + StrBufExtract_token(r, Buf, 0, '|'); + wc_printf("topref %s, ", ChrPtr(r)); + bp->refs = HashLittle(ChrPtr(r), StrLength(r)); } } wc_printf("
\n"); } FreeStrBuf(&Buf); + FreeStrBuf(&r); }