Overview
SHA1 Hash: | 2cb3290e6767e51d190f746abbac4f330ae14517 |
---|---|
Date: | 2008-02-03 18:00:27 |
User: | stephan |
Comment: | Fixed a memory leak in tagview_page_list_tags(). Minor other refactorings. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/tagview.c from [83c508c8f6] to [00e0d408b7].
@@ -27,10 +27,18 @@ */ #include <assert.h> #include "config.h" #include "tagview.h" + +#if 1 +# define TAGVIEW_DEFAULT_FILTER "AND t.tagname NOT GLOB 'wiki-*' " +#else +# define TAGVIEW_DEFAULT_FILTER +#endif + + /** tagview_strxform_f is a typedef for funcs with the following policy: They accept a const string which they then transform into some other form. They return a transformed copy, which the caller is responsible @@ -59,11 +67,11 @@ { const int offset = 10; char shortname[offset+1]; shortname[offset] = '\0'; memcpy( shortname, uuid, offset ); - return mprintf( "<tt><a href='%s/vinfo/%s'><strong>%s</strong>%s</a></tt>", + return mprintf( "<tt><a href='%s/vinfo/%s'><span style='font-size:1.5em'>%s</span>%s</a></tt>", g.zBaseURL, uuid, shortname, uuid+offset ); } /** Returns a hyperlink to the given tag. */ static char * tagview_xf_link_to_tagid( char const * tagid ) @@ -186,24 +194,24 @@ @ <h2>Tags matching [%s(likeclause)]:</h2> } else { limitstr = mprintf( "LIMIT %d", limit ); - @ <h2>%d(limit) most recent non-wiki tags:</h2> + @ <h2>%d(limit) most recent tags:</h2> } char * sql = mprintf( "SELECT t.tagid, t.tagname, DATETIME(tx.mtime), b.uuid " "FROM tag t, tagxref tx, blob b " "WHERE (t.tagid=tx.tagid) and (tx.srcid=b.rid) " "AND (tx.tagtype != 0) %s " - "AND t.tagname NOT GLOB 'wiki-*' " + TAGVIEW_DEFAULT_FILTER "ORDER BY tx.mtime DESC %s", likeclause ? likeclause : " ", limitstr ? limitstr : " " ); - /* " AND t.tagname NOT GLOB 'wiki-*'" // Do we want this?? */ - + if( limitstr ) free(limitstr); + if( likeclause ) free(likeclause); char const * const colnames[] = { "Tag ID", "Name", "Timestamp", "Version" }; tagview_strxform_f xf[] = { tagview_xf_link_to_tagid, @@ -244,11 +252,11 @@ @ <h2>Tag #%d(tagid):</h2> char * sql = mprintf( "SELECT DISTINCT (t.tagname), DATETIME(tx.mtime), b.uuid " "FROM tag t, tagxref tx, blob b " "WHERE (t.tagid=%d) AND (t.tagid=tx.tagid) AND (tx.srcid=b.rid) " - "AND t.tagname NOT GLOB 'wiki-*' " + TAGVIEW_DEFAULT_FILTER "ORDER BY tx.mtime DESC", tagid); char const * const colnames[] = { "Tag Name", "Timestamp", "Version" }; @@ -269,11 +277,11 @@ @ <h2>Tag '%s(tagname)':</h2> char * sql = mprintf( "SELECT DISTINCT t.tagid, DATETIME(tx.mtime), b.uuid " "FROM tag t, tagxref tx, blob b " "WHERE (t.tagname='%q') AND (t.tagid=tx.tagid) AND (tx.srcid=b.rid) " - "AND t.tagname NOT GLOB 'wiki-*' " + TAGVIEW_DEFAULT_FILTER "ORDER BY tx.mtime DESC", tagname); char const * const colnames[] = { "Tag ID", "Timestamp", "Version" }; @@ -289,11 +297,10 @@ /* ** WEBPAGE: /tagview */ void tagview_page(void){ - login_check_credentials(); if( !g.okRdWiki ){ login_needed(); } style_header("Tags"); @@ -316,5 +323,7 @@ { tagview_page_default(); } style_footer(); } + +#undef TAGVIEW_DEFAULT_FILTER