You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by pq...@apache.org on 2008/12/27 06:27:53 UTC
svn commit: r729600 [1/3] - in /httpd/mod_mbox/trunk: ./ config/ m4/
module-2.0/ scripts/
Author: pquerna
Date: Fri Dec 26 21:27:52 2008
New Revision: 729600
URL: http://svn.apache.org/viewvc?rev=729600&view=rev
Log:
Merge https://svn.apache.org/repos/asf/httpd/sandbox/mod_mbox-3 branch into trunk,
it turns out the things I've done so far aren't really insane, just cleanups that need to be done.
Added:
httpd/mod_mbox/trunk/SConstruct
- copied unchanged from r729599, httpd/sandbox/mod_mbox-3/SConstruct
httpd/mod_mbox/trunk/module-2.0/mod_mbox_sitemap.c
- copied unchanged from r729599, httpd/sandbox/mod_mbox-3/module-2.0/mod_mbox_sitemap.c
httpd/mod_mbox/trunk/scripts/site-sitemap.py
- copied unchanged from r729599, httpd/sandbox/mod_mbox-3/scripts/site-sitemap.py
Removed:
httpd/mod_mbox/trunk/Makefile.am
httpd/mod_mbox/trunk/autogen.sh
httpd/mod_mbox/trunk/config/
httpd/mod_mbox/trunk/configure.ac
httpd/mod_mbox/trunk/m4/
httpd/mod_mbox/trunk/module-2.0/Makefile.am
httpd/mod_mbox/trunk/module-2.0/build-dso
httpd/mod_mbox/trunk/module-2.0/calc_threads.c
httpd/mod_mbox/trunk/module-2.0/generate_index.c
httpd/mod_mbox/trunk/module-2.0/load_msgid.c
httpd/mod_mbox/trunk/module-2.0/mbox_search.c
httpd/mod_mbox/trunk/module-2.0/mbox_search.h
httpd/mod_mbox/trunk/module-2.0/mod_mbox_search.c
Modified:
httpd/mod_mbox/trunk/ (props changed)
httpd/mod_mbox/trunk/module-2.0/ (props changed)
httpd/mod_mbox/trunk/module-2.0/load_index.c
httpd/mod_mbox/trunk/module-2.0/mbox_cache.c
httpd/mod_mbox/trunk/module-2.0/mbox_cache.h
httpd/mod_mbox/trunk/module-2.0/mbox_externals.c
httpd/mod_mbox/trunk/module-2.0/mbox_externals.h
httpd/mod_mbox/trunk/module-2.0/mbox_parse.c
httpd/mod_mbox/trunk/module-2.0/mbox_parse.h
httpd/mod_mbox/trunk/module-2.0/mbox_sort.c
httpd/mod_mbox/trunk/module-2.0/mbox_sort.h
httpd/mod_mbox/trunk/module-2.0/mbox_thread.c
httpd/mod_mbox/trunk/module-2.0/mbox_thread.h
httpd/mod_mbox/trunk/module-2.0/mod-mbox-util.c
httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
httpd/mod_mbox/trunk/module-2.0/mod_mbox.h
httpd/mod_mbox/trunk/module-2.0/mod_mbox_cte.c
httpd/mod_mbox/trunk/module-2.0/mod_mbox_file.c
httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c
httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c
httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c
Propchange: httpd/mod_mbox/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Dec 26 21:27:52 2008
@@ -1,7 +1,5 @@
-config.in
-Makefile.in
-Makefile
-aclocal.m4
-configure
-libtool
-config.*
+build.py
+mod_mbox.so
+mod-mbox-util
+.sconsign.*
+libmbox.a
Propchange: httpd/mod_mbox/trunk/
------------------------------------------------------------------------------
svn:mergeinfo = /httpd/sandbox/mod_mbox-3:729551-729599
Propchange: httpd/mod_mbox/trunk/module-2.0/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Dec 26 21:27:52 2008
@@ -1,16 +1,7 @@
-Makefile
-Makefile.in
-.deps
-.libs
*.lo
*.slo
*.la
-*.loT
+*.os
*.so
-generate_index
-load_index
-calc_threads
-load_msgid
mod-mbox-util
mod_mbox_config.h
-stamp-*
Modified: httpd/mod_mbox/trunk/module-2.0/load_index.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/load_index.c?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/load_index.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/load_index.c Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -21,7 +21,7 @@
#include "apr_strings.h"
#include "mbox_parse.h"
-int main(int argc, char** argv)
+int main(int argc, char **argv)
{
request_rec r;
server_rec s;
@@ -30,8 +30,7 @@
MBOX_LIST *l;
Message *m;
- if (argc <= 1)
- {
+ if (argc <= 1) {
puts("Please give me a filename to generate an index for.\n");
return EXIT_FAILURE;
}
@@ -53,9 +52,8 @@
return status;
l = load_index(&r, f);
- while (l)
- {
- m = (Message*)l->value;
+ while (l) {
+ m = (Message *) l->value;
printf("From: %s\n", m->from);
l = l->next;
}
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_cache.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_cache.c?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_cache.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_cache.c Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -22,20 +22,20 @@
#define LIST_DB_NAME "listinfo.db"
-static char* str_cache_version = "_cache_version";
-static char* str_cache_mtime = "_cache_mtime";
-static char* str_cache_list = "_cache_list";
-static char* str_cache_domain = "_cache_domain";
+static char *str_cache_version = "_cache_version";
+static char *str_cache_mtime = "_cache_mtime";
+static char *str_cache_list = "_cache_list";
+static char *str_cache_domain = "_cache_domain";
static apr_status_t mli_cleanup(void *mlix)
{
- mbox_cache_info* mli = (mbox_cache_info*) mlix;
+ mbox_cache_info *mli = (mbox_cache_info *) mlix;
apr_dbm_close(mli->db);
return APR_SUCCESS;
}
/* handy debugging function */
-static void dump_dbm(apr_dbm_t* d)
+static void dump_dbm(apr_dbm_t *d)
{
apr_status_t status;
apr_datum_t key;
@@ -47,23 +47,22 @@
}
}
-APR_DECLARE(void)
-mbox_cache_close(mbox_cache_info* mlix)
+APR_DECLARE(void) mbox_cache_close(mbox_cache_info *mlix)
{
apr_pool_cleanup_kill(mlix->pool, (void *) mlix, mli_cleanup);
mli_cleanup(mlix);
}
APR_DECLARE(apr_status_t)
-mbox_cache_update(mbox_cache_info** mlix,
- const char* path, apr_pool_t* pool,
- char* list, char* domain)
+ mbox_cache_update(mbox_cache_info ** mlix,
+ const char *path, apr_pool_t *pool,
+ char *list, char *domain)
{
apr_status_t rv;
- char* temp;
+ char *temp;
apr_datum_t key;
apr_datum_t nv;
- mbox_cache_info* mli;
+ mbox_cache_info *mli;
int update_only = 0;
int tver;
@@ -76,7 +75,7 @@
if (rv != APR_SUCCESS) {
rv = apr_dbm_open(&mli->db, temp, APR_DBM_RWCREATE,
- APR_OS_DEFAULT, pool);
+ APR_OS_DEFAULT, pool);
mli->mtime = 0;
if (rv != APR_SUCCESS) {
@@ -153,22 +152,20 @@
}
APR_DECLARE(apr_status_t)
-mbox_cache_get(mbox_cache_info** mlix,
- const char* path, apr_pool_t* p)
+ mbox_cache_get(mbox_cache_info ** mlix, const char *path, apr_pool_t *p)
{
apr_status_t rv;
- char* temp;
+ char *temp;
apr_datum_t key;
apr_datum_t nv;
int tver;
- mbox_cache_info* mli;
+ mbox_cache_info *mli;
temp = apr_pstrcat(p, path, "/", LIST_DB_NAME, NULL);
mli = apr_palloc(p, sizeof(mbox_cache_info));
- rv = apr_dbm_open(&mli->db, temp, APR_DBM_READONLY,
- APR_OS_DEFAULT, p);
+ rv = apr_dbm_open(&mli->db, temp, APR_DBM_READONLY, APR_OS_DEFAULT, p);
if (rv != APR_SUCCESS) {
return rv;
@@ -232,7 +229,7 @@
}
APR_DECLARE(apr_status_t)
-mbox_cache_get_count(mbox_cache_info* mli, int *count, char* path)
+ mbox_cache_get_count(mbox_cache_info *mli, int *count, char *path)
{
apr_status_t rv = APR_SUCCESS;
apr_datum_t key;
@@ -253,7 +250,7 @@
}
APR_DECLARE(apr_status_t)
-mbox_cache_set_count(mbox_cache_info* mli, int count, char* path)
+ mbox_cache_set_count(mbox_cache_info *mli, int count, char *path)
{
apr_status_t rv = APR_SUCCESS;
char v[sizeof(int)];
@@ -274,7 +271,7 @@
APR_DECLARE(apr_status_t)
-mbox_cache_touch(mbox_cache_info* mli)
+ mbox_cache_touch(mbox_cache_info *mli)
{
apr_status_t rv = APR_SUCCESS;
char v[sizeof(apr_time_t)];
@@ -292,5 +289,3 @@
/* dump_dbm(mli->db); */
return rv;
}
-
-
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_cache.h
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_cache.h?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_cache.h (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_cache.h Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -45,39 +45,38 @@
*
* Changes how directions are given to subscribe.
*/
-typedef enum mbox_mlist_manager_e {
+typedef enum mbox_mlist_manager_e
+{
MANAGER_EZMLM = 0,
} mbox_mlist_manager_e;
-typedef struct mbox_cache_info {
+typedef struct mbox_cache_info
+{
int version;
apr_time_t mtime;
mbox_mlist_manager_e type;
- const char* list;
- const char* domain;
- apr_dbm_t* db;
- apr_pool_t* pool;
+ const char *list;
+ const char *domain;
+ apr_dbm_t *db;
+ apr_pool_t *pool;
} mbox_cache_info;
-APR_DECLARE(void)
-mbox_cache_close(mbox_cache_info* mli);
+APR_DECLARE(void) mbox_cache_close(mbox_cache_info *mli);
APR_DECLARE(apr_status_t)
-mbox_cache_update(mbox_cache_info** mli,
- const char* path, apr_pool_t* p,
- char* list, char* domain);
+ mbox_cache_update(mbox_cache_info ** mli,
+ const char *path, apr_pool_t *p, char *list, char *domain);
APR_DECLARE(apr_status_t)
-mbox_cache_get(mbox_cache_info** mli,
- const char* path, apr_pool_t* p);
+ mbox_cache_get(mbox_cache_info ** mli, const char *path, apr_pool_t *p);
APR_DECLARE(apr_status_t)
-mbox_cache_get_count(mbox_cache_info* mli, int *count, char* path);
+ mbox_cache_get_count(mbox_cache_info *mli, int *count, char *path);
APR_DECLARE(apr_status_t)
-mbox_cache_set_count(mbox_cache_info* mli, int count, char* path);
+ mbox_cache_set_count(mbox_cache_info *mli, int count, char *path);
APR_DECLARE(apr_status_t)
-mbox_cache_touch(mbox_cache_info* mli);
+ mbox_cache_touch(mbox_cache_info *mli);
#endif
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_externals.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_externals.c?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_externals.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_externals.c Fri Dec 26 21:27:52 2008
@@ -1,18 +1,18 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
-* applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
/** THIS FILE MUST BE REMOVED WHEN THE APR-UTIL LIBRARY WILL BE FIXED
* AND PACKAGED. */
@@ -82,7 +82,7 @@
}
}
- return 0; /* We only get here if mask is corrupted (exceeds 256) */
+ return 0; /* We only get here if mask is corrupted (exceeds 256) */
}
/* Parses RFC 822 or RFC 2822 dates. */
@@ -106,34 +106,34 @@
apr_time_t result;
int mint, mon;
const char *monstr, *timstr, *gmtstr;
- static const int months[12] =
- {
- ('J' << 16) | ('a' << 8) | 'n', ('F' << 16) | ('e' << 8) | 'b',
- ('M' << 16) | ('a' << 8) | 'r', ('A' << 16) | ('p' << 8) | 'r',
- ('M' << 16) | ('a' << 8) | 'y', ('J' << 16) | ('u' << 8) | 'n',
- ('J' << 16) | ('u' << 8) | 'l', ('A' << 16) | ('u' << 8) | 'g',
- ('S' << 16) | ('e' << 8) | 'p', ('O' << 16) | ('c' << 8) | 't',
- ('N' << 16) | ('o' << 8) | 'v', ('D' << 16) | ('e' << 8) | 'c' };
+ static const int months[12] = {
+ ('J' << 16) | ('a' << 8) | 'n', ('F' << 16) | ('e' << 8) | 'b',
+ ('M' << 16) | ('a' << 8) | 'r', ('A' << 16) | ('p' << 8) | 'r',
+ ('M' << 16) | ('a' << 8) | 'y', ('J' << 16) | ('u' << 8) | 'n',
+ ('J' << 16) | ('u' << 8) | 'l', ('A' << 16) | ('u' << 8) | 'g',
+ ('S' << 16) | ('e' << 8) | 'p', ('O' << 16) | ('c' << 8) | 't',
+ ('N' << 16) | ('o' << 8) | 'v', ('D' << 16) | ('e' << 8) | 'c'
+ };
if (!date)
return APR_DATE_BAD;
/* Not all dates have text months at the beginning. */
- if (!apr_isdigit(date[0]))
- {
- while (*date && apr_isspace(*date)) /* Find first non-whitespace char */
+ if (!apr_isdigit(date[0])) {
+ while (*date && apr_isspace(*date)) /* Find first non-whitespace char */
++date;
if (*date == '\0')
return APR_DATE_BAD;
- if ((date = strchr(date, ' ')) == NULL) /* Find space after weekday */
+ if ((date = strchr(date, ' ')) == NULL) /* Find space after weekday */
return APR_DATE_BAD;
- ++date; /* Now pointing to first char after space, which should be */ }
+ ++date; /* Now pointing to first char after space, which should be */
+ }
/* start of the actual date information for all 11 formats. */
- if (mbox_date_checkmask(date, "## @$$ #### ##:##:## *")) { /* RFC 1123 format */
+ if (mbox_date_checkmask(date, "## @$$ #### ##:##:## *")) { /* RFC 1123 format */
ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100;
if (ds.tm_year < 0)
@@ -149,7 +149,7 @@
TIMEPARSE_STD(ds, timstr);
}
- else if (mbox_date_checkmask(date, "##-@$$-## ##:##:## *")) {/* RFC 850 format */
+ else if (mbox_date_checkmask(date, "##-@$$-## ##:##:## *")) { /* RFC 850 format */
ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0');
if (ds.tm_year < 70)
@@ -185,7 +185,7 @@
TIMEPARSE_STD(ds, timstr);
}
else if (mbox_date_checkmask(date, "# @$$ #### ##:##:## *")) {
- /* RFC 1123 format*/
+ /* RFC 1123 format */
ds.tm_year = ((date[6] - '0') * 10 + (date[7] - '0') - 19) * 100;
if (ds.tm_year < 0)
@@ -245,7 +245,7 @@
timstr = date + 10;
gmtstr = NULL;
- TIMEPARSE(ds, timstr[0],timstr[1], timstr[3],timstr[4], '0','0');
+ TIMEPARSE(ds, timstr[0], timstr[1], timstr[3], timstr[4], '0', '0');
}
else if (mbox_date_checkmask(date, "# @$$ ## ##:## *")) {
/* Loser format. This is quite bogus. */
@@ -260,7 +260,7 @@
timstr = date + 9;
gmtstr = NULL;
- TIMEPARSE(ds, timstr[0],timstr[1], timstr[3],timstr[4], '0','0');
+ TIMEPARSE(ds, timstr[0], timstr[1], timstr[3], timstr[4], '0', '0');
}
else if (mbox_date_checkmask(date, "## @$$ ## #:##:## *")) {
/* Loser format. This is quite bogus. */
@@ -275,10 +275,11 @@
timstr = date + 9;
gmtstr = date + 18;
- TIMEPARSE(ds, '0',timstr[1], timstr[3],timstr[4], timstr[6],timstr[7]);
+ TIMEPARSE(ds, '0', timstr[1], timstr[3], timstr[4], timstr[6],
+ timstr[7]);
}
else if (mbox_date_checkmask(date, "# @$$ ## #:##:## *")) {
- /* Loser format. This is quite bogus. */
+ /* Loser format. This is quite bogus. */
ds.tm_year = ((date[6] - '0') * 10) + (date[7] - '0');
if (ds.tm_year < 70)
@@ -290,7 +291,8 @@
timstr = date + 8;
gmtstr = date + 17;
- TIMEPARSE(ds, '0',timstr[1], timstr[3],timstr[4], timstr[6],timstr[7]);
+ TIMEPARSE(ds, '0', timstr[1], timstr[3], timstr[4], timstr[6],
+ timstr[7]);
}
else if (mbox_date_checkmask(date, " # @$$ #### ##:##:## *")) {
/* RFC 1123 format with a space instead of a leading zero. */
@@ -310,9 +312,9 @@
TIMEPARSE_STD(ds, timstr);
}
else if (mbox_date_checkmask(date, "##-@$$-#### ##:##:## *")) {
- /* RFC 1123 with dashes instead of spaces between date/month/year
- * This also looks like RFC 850 with four digit years.
- */
+ /* RFC 1123 with dashes instead of spaces between date/month/year
+ * This also looks like RFC 850 with four digit years.
+ */
ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100;
if (ds.tm_year < 0)
return APR_DATE_BAD;
@@ -349,12 +351,11 @@
/* February gets special check for leapyear */
- if ((mon == 1) &&
- ((ds.tm_mday > 29)
- || ((ds.tm_mday == 29)
- && ((ds.tm_year & 3)
- || (((ds.tm_year % 100) == 0)
- && (((ds.tm_year % 400) != 100)))))))
+ if ((mon == 1) && ((ds.tm_mday > 29)
+ || ((ds.tm_mday == 29)
+ && ((ds.tm_year & 3)
+ || (((ds.tm_year % 100) == 0)
+ && (((ds.tm_year % 400) != 100)))))))
return APR_DATE_BAD;
ds.tm_mon = mon;
@@ -371,17 +372,17 @@
/* Do we have a timezone ? */
if (gmtstr) {
int offset;
- switch (*gmtstr) {
- case '-':
- offset = atoi(gmtstr+1);
- ds.tm_gmtoff -= (offset / 100) * 60 * 60;
- ds.tm_gmtoff -= (offset % 100) * 60;
- break;
- case '+':
- offset = atoi(gmtstr+1);
- ds.tm_gmtoff += (offset / 100) * 60 * 60;
- ds.tm_gmtoff += (offset % 100) * 60;
- break;
+ switch (*gmtstr) {
+ case '-':
+ offset = atoi(gmtstr + 1);
+ ds.tm_gmtoff -= (offset / 100) * 60 * 60;
+ ds.tm_gmtoff -= (offset % 100) * 60;
+ break;
+ case '+':
+ offset = atoi(gmtstr + 1);
+ ds.tm_gmtoff += (offset / 100) * 60 * 60;
+ ds.tm_gmtoff += (offset % 100) * 60;
+ break;
}
}
@@ -407,20 +408,20 @@
char *p1, *p2;
if (*s2 == '\0') {
/* an empty s2 */
- return((char *)s1);
+ return ((char *) s1);
}
- while(1) {
- for ( ; (*s1 != '\0') && (apr_tolower(*s1) != apr_tolower(*s2)); s1++);
+ while (1) {
+ for (; (*s1 != '\0') && (apr_tolower(*s1) != apr_tolower(*s2)); s1++);
if (*s1 == '\0') {
- return(NULL);
+ return (NULL);
}
/* found first character of s2, see if the rest matches */
- p1 = (char *)s1;
- p2 = (char *)s2;
+ p1 = (char *) s1;
+ p2 = (char *) s2;
for (++p1, ++p2; apr_tolower(*p1) == apr_tolower(*p2); ++p1, ++p2) {
if (*p1 == '\0') {
/* both strings ended together */
- return((char *)s1);
+ return ((char *) s1);
}
}
if (*p2 == '\0') {
@@ -430,5 +431,5 @@
/* didn't find a match here, try starting at next character in s1 */
s1++;
}
- return((char *)s1);
+ return ((char *) s1);
}
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_externals.h
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_externals.h?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_externals.h (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_externals.h Fri Dec 26 21:27:52 2008
@@ -1,18 +1,19 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
-* applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/** THIS FILE MUST BE REMOVED WHEN THE APR-UTIL LIBRARY WILL BE FIXED
* AND PACKAGED. */
@@ -27,7 +28,8 @@
#include "apr_time.h"
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
#define APR_DATE_BAD ((apr_time_t)0)
@@ -39,4 +41,4 @@
}
#endif
-#endif /* MBOX_EXTERNALS_H */
+#endif /* MBOX_EXTERNALS_H */
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_parse.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_parse.c?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_parse.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_parse.c Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -33,7 +33,6 @@
#include "mbox_parse.h"
#include "mbox_sort.h"
-#include "mbox_search.h"
/* FIXME: Remove this when apr_date_parse_rfc() and ap_strcasestr() are fixed ! */
#include "mbox_externals.h"
@@ -49,17 +48,18 @@
#define MSGID_DBM_SUFFIX ".msgsum"
-typedef struct mb_dbm_data {
+typedef struct mb_dbm_data
+{
apr_off_t msg_start;
apr_off_t body_start;
apr_off_t body_end;
mbox_cte_e cte;
apr_time_t date;
- const char* from;
- const char* subject;
- const char* references;
- const char* content_type;
- const char* boundary;
+ const char *from;
+ const char *subject;
+ const char *references;
+ const char *content_type;
+ const char *boundary;
} mb_dbm_data;
/* Fills the MBOX_BUFF structure with data from the backing file descriptor.
@@ -69,17 +69,14 @@
{
int len;
- if (fb->fd)
- {
+ if (fb->fd) {
len = strlen(fb->b);
/* We are backed by a file descriptor.
* Read a new set of characters in.
*/
- do
- {
- if (len > 0)
- {
+ do {
+ if (len > 0) {
memmove(fb->sb, fb->b, len);
fb->rb = fb->sb + len;
}
@@ -109,12 +106,12 @@
*
* Only array element 0 of the input char* is guaranteed to be valid.
*/
-static int mbox_blookc(char* buff, MBOX_BUFF *fb)
+static int mbox_blookc(char *buff, MBOX_BUFF *fb)
{
*buff = '\0';
if (!fb || !fb->b || !fb->b[0])
- return 0;
+ return 0;
buff[0] = fb->b[0];
@@ -143,23 +140,20 @@
tmp = strchr(fb->b, LF);
- if (!tmp)
- {
- if (fb->fd)
- {
+ if (!tmp) {
+ if (fb->fd) {
mbox_fillbuf(fb);
- tmp = strchr(fb->b,LF);
+ tmp = strchr(fb->b, LF);
if (tmp)
len = tmp - fb->b;
- else
- {
+ else {
fb->b = 0;
return -1;
}
}
- else /* if (fb->sb) */
- {
+ else { /* if (fb->sb) */
+
fb->b = 0;
return -1;
}
@@ -168,17 +162,15 @@
len = tmp - fb->b;
/* Ensure that we can not overflow */
- if (len + 2 < n)
- {
+ if (len + 2 < n) {
/* Don't copy the linefeed as we will play tricks with it. */
memcpy(buff, fb->b, len);
/* Advance our pointer past the linefeed. */
fb->b += len + 1;
}
- else
- {
- /* Leave space for EOL and term NULL.*/
+ else {
+ /* Leave space for EOL and term NULL. */
len = n - 2;
memcpy(buff, fb->b, len);
@@ -186,9 +178,9 @@
fb->b += len;
}
- if (!len || buff[len - 1] != CR) /* Blank line or no previous CR */
+ if (!len || buff[len - 1] != CR) /* Blank line or no previous CR */
buff[len++] = '\n';
- else /* replace CR with LF */
+ else /* replace CR with LF */
buff[--len] = '\n';
/* Add terminating null. */
@@ -223,7 +215,7 @@
pos = s;
do {
- retval = mbox_bgets(pos, n, in); /* retval == -1 if error, 0 if EOF */
+ retval = mbox_bgets(pos, n, in); /* retval == -1 if error, 0 if EOF */
if (retval <= 0) {
total = ((retval < 0) && (total == 0)) ? -1 : total;
break;
@@ -252,7 +244,7 @@
++n;
}
else
- break; /* if not, input line exceeded buffer size */
+ break; /* if not, input line exceeded buffer size */
/* Continue appending if line folding is desired and
* the last line was not empty and we have room in the buffer and
@@ -260,8 +252,8 @@
*/
} while (fold && (retval != 1) && (n > 1)
- && (mbox_blookc(&next, in) == 1)
- && ((next == ' ') || (next == '\t')));
+ && (mbox_blookc(&next, in) == 1)
+ && ((next == ' ') || (next == '\t')));
return total;
}
@@ -270,9 +262,9 @@
*
* Adapted from http_protocol.c - get_mime_headers()
*/
-static apr_table_t *load_mbox_mime_tables(request_rec *r, MBOX_BUFF * b)
+static apr_table_t *load_mbox_mime_tables(request_rec *r, MBOX_BUFF *b)
{
- char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* getline's two extra */
+ char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* getline's two extra */
char *value;
char *copy;
int len;
@@ -303,12 +295,12 @@
memcpy(copy, field, len + 1);
if (!(value = strchr(copy, ':'))) /* Find the colon separator */
- continue; /* or skip the bad line */
+ continue; /* or skip the bad line */
*value = '\0';
++value;
while (*value == ' ' || *value == '\t')
- ++value; /* Skip to start of value */
+ ++value; /* Skip to start of value */
apr_table_addn(tmp_headers, copy, value);
}
@@ -320,12 +312,10 @@
*/
static void skipLine(MBOX_BUFF *b)
{
- char * tmp = memchr(b->b, LF, b->len - (b->b - b->sb));
+ char *tmp = memchr(b->b, LF, b->len - (b->b - b->sb));
- if (!tmp)
- {
- if (b->fd)
- {
+ if (!tmp) {
+ if (b->fd) {
mbox_fillbuf(b);
skipLine(b);
}
@@ -337,10 +327,10 @@
}
/* Inserts the key and value into the MBOX_LIST arranged by the key value. */
-static apr_status_t put_entry(request_rec *r, MBOX_LIST **head,
+static apr_status_t put_entry(request_rec *r, MBOX_LIST ** head,
apr_time_t t, void *value)
{
- MBOX_LIST* new = (MBOX_LIST*) apr_pcalloc(r->pool, sizeof(MBOX_LIST));
+ MBOX_LIST *new = (MBOX_LIST *) apr_pcalloc(r->pool, sizeof(MBOX_LIST));
new->next = *head;
*head = new;
@@ -358,16 +348,16 @@
*/
static int mbox_compare_list(void *p, void *q, void *pointer)
{
- MBOX_LIST *a = (MBOX_LIST*)p;
- MBOX_LIST *b = (MBOX_LIST*)q;
+ MBOX_LIST *a = (MBOX_LIST *) p;
+ MBOX_LIST *b = (MBOX_LIST *) q;
return ((a->key > b->key) ? 1 : -1);
}
static int mbox_reverse_list(void *p, void *q, void *pointer)
{
- MBOX_LIST *a = (MBOX_LIST*)p;
- MBOX_LIST *b = (MBOX_LIST*)q;
+ MBOX_LIST *a = (MBOX_LIST *) p;
+ MBOX_LIST *b = (MBOX_LIST *) q;
return ((a->key > b->key) ? -1 : 1);
}
@@ -378,10 +368,10 @@
*/
static int mbox_compare_list_author(void *p, void *q, void *pointer)
{
- MBOX_LIST *a = (MBOX_LIST*)p;
- MBOX_LIST *b = (MBOX_LIST*)q;
- Message *c = (Message*)a->value;
- Message *d = (Message*)b->value;
+ MBOX_LIST *a = (MBOX_LIST *) p;
+ MBOX_LIST *b = (MBOX_LIST *) q;
+ Message *c = (Message *) a->value;
+ Message *d = (Message *) b->value;
int cmp;
if (!c->str_from) {
@@ -404,21 +394,21 @@
/*
* Uses the sort_linked_list function from mbox_sort (merge-sort).
*/
-MBOX_LIST* mbox_sort_list(MBOX_LIST* l, int flags)
+MBOX_LIST *mbox_sort_list(MBOX_LIST *l, int flags)
{
- switch (flags)
- {
+ switch (flags) {
case MBOX_SORT_DATE:
- l = (MBOX_LIST*) mbox_sort_linked_list(l, 0, mbox_compare_list,
- NULL, NULL);
+ l = (MBOX_LIST *) mbox_sort_linked_list(l, 0, mbox_compare_list,
+ NULL, NULL);
break;
case MBOX_SORT_REVERSE_DATE:
- l = (MBOX_LIST*) mbox_sort_linked_list(l, 0, mbox_reverse_list,
- NULL, NULL);
+ l = (MBOX_LIST *) mbox_sort_linked_list(l, 0, mbox_reverse_list,
+ NULL, NULL);
break;
case MBOX_SORT_AUTHOR:
- l = (MBOX_LIST*) mbox_sort_linked_list(l, 0, mbox_compare_list_author,
- NULL, NULL);
+ l = (MBOX_LIST *) mbox_sort_linked_list(l, 0,
+ mbox_compare_list_author,
+ NULL, NULL);
break;
}
@@ -431,8 +421,7 @@
static void parse_from(request_rec *r, Message *m)
{
char *startFrom, *endFrom;
- if (m->from)
- {
+ if (m->from) {
/* Froms come in many shapes and forms.
* Notably, we want to try and handle:
* 1) "Bob Smith" <bs...@example.com>
@@ -445,26 +434,22 @@
/* FIXME: Optimize string matching */
startFrom = apr_pstrdup(r->pool, m->from);
endFrom = strchr(startFrom, '"');
- if (endFrom) /* Case 1 */
- {
+ if (endFrom) { /* Case 1 */
startFrom = ++endFrom;
endFrom = strchr(startFrom, '"');
if (endFrom)
*endFrom = '\0';
}
- else
- {
+ else {
endFrom = strchr(startFrom, '<');
- if (endFrom)
- {
- if (endFrom == startFrom) /* Case 3 */
- {
+ if (endFrom) {
+ if (endFrom == startFrom) { /* Case 3 */
endFrom = strchr(++startFrom, '>');
if (endFrom)
*endFrom = '\0';
}
- else /* Case 2 */
- {
+ else { /* Case 2 */
+
/* FIXME: What about Bob Smith<bs...@example.com>? */
*endFrom = '\0';
endFrom = strrchr(startFrom, ' ');
@@ -472,11 +457,9 @@
*endFrom = '\0';
}
}
- else
- {
+ else {
endFrom = strchr(startFrom, '(');
- if (endFrom) /* Case 5 */
- {
+ if (endFrom) { /* Case 5 */
startFrom = ++endFrom;
endFrom = strchr(startFrom, ')');
if (endFrom)
@@ -493,14 +476,12 @@
{
char *startRef, *endRef;
/* FIXME: Is table the right data structure here? */
- if (m->raw_ref)
- {
+ if (m->raw_ref) {
m->references = apr_table_make(r->pool, 50);
startRef = m->raw_ref;
endRef = strchr(startRef, '>');
- while (endRef != NULL)
- {
- startRef = apr_pstrndup(r->pool, startRef, endRef - startRef + 1 );
+ while (endRef != NULL) {
+ startRef = apr_pstrndup(r->pool, startRef, endRef - startRef + 1);
apr_collapse_spaces(startRef, startRef);
apr_table_setn(m->references, startRef, m->msgID);
startRef = ++endRef;
@@ -528,11 +509,11 @@
apr_time_exp_gmt(&time_exp, m->date);
- m->str_date = (char*)apr_pcalloc(r->pool, APR_RFC822_DATE_LEN);
- m->rfc822_date = (char*)apr_pcalloc(r->pool, APR_RFC822_DATE_LEN);
+ m->str_date = (char *) apr_pcalloc(r->pool, APR_RFC822_DATE_LEN);
+ m->rfc822_date = (char *) apr_pcalloc(r->pool, APR_RFC822_DATE_LEN);
apr_strftime(m->str_date, &len, APR_RFC822_DATE_LEN,
- "%a, %d %b, %H:%M", &time_exp);
+ "%a, %d %b, %H:%M", &time_exp);
apr_rfc822_date(m->rfc822_date, m->date);
/* Parse the references into a table. */
@@ -555,36 +536,35 @@
#define sstrlen(str) (str ? strlen(str) + 1 : 0)
-static apr_status_t fetch_msgc(apr_pool_t* pool, apr_dbm_t* database,
- const char* key, mb_dbm_data* msgc)
+static apr_status_t fetch_msgc(apr_pool_t *pool, apr_dbm_t *database,
+ const char *key, mb_dbm_data *msgc)
{
apr_datum_t msgKey, msgValue;
int status;
int pos = 0;
apr_uint16_t tlen = 0;
- msgKey.dptr = (char*) key;
+ msgKey.dptr = (char *) key;
msgKey.dsize = strlen(key) + 1;
status = apr_dbm_fetch(database, msgKey, &msgValue);
- if (status != APR_SUCCESS || !msgValue.dptr || !msgValue.dsize)
- {
+ if (status != APR_SUCCESS || !msgValue.dptr || !msgValue.dsize) {
/* TODO: Error out. */
return APR_EGENERAL;
}
- memcpy(&msgc->msg_start, msgValue.dptr+pos, sizeof(msgc->msg_start));
+ memcpy(&msgc->msg_start, msgValue.dptr + pos, sizeof(msgc->msg_start));
pos += sizeof(msgc->msg_start);
- memcpy(&msgc->body_start, msgValue.dptr+pos, sizeof(msgc->body_start));
+ memcpy(&msgc->body_start, msgValue.dptr + pos, sizeof(msgc->body_start));
pos += sizeof(msgc->body_start);
- memcpy(&msgc->body_end, msgValue.dptr+pos, sizeof(msgc->body_end));
+ memcpy(&msgc->body_end, msgValue.dptr + pos, sizeof(msgc->body_end));
pos += sizeof(msgc->body_end);
- memcpy(&msgc->date, msgValue.dptr+pos, sizeof(msgc->date));
+ memcpy(&msgc->date, msgValue.dptr + pos, sizeof(msgc->date));
pos += sizeof(msgc->date);
- memcpy(&msgc->cte, msgValue.dptr+pos, sizeof(msgc->cte));
+ memcpy(&msgc->cte, msgValue.dptr + pos, sizeof(msgc->cte));
pos += sizeof(msgc->cte);
fetch_cstring(pool, msgc->from, msgValue.dptr, pos, tlen);
@@ -605,31 +585,19 @@
pos += xlen; \
} while (0);
-static apr_status_t store_msgc(apr_pool_t* pool, apr_dbm_t* database,
- const char* key, mb_dbm_data* msgc,
- mbox_indexer_t *indexer,
- const char* list, const char* domain)
+static apr_status_t store_msgc(apr_pool_t *pool, apr_dbm_t *database,
+ const char *key, mb_dbm_data *msgc,
+ const char *list, const char *domain)
{
apr_datum_t msgKey, msgValue;
int vlen;
int pos = 0;
apr_uint16_t tlen = 0;
- char* value;
+ char *value;
if (!database || !key || !msgc)
return APR_EGENERAL;
- if (indexer != NULL) {
- mbox_search_doc_t tdoc;
- tdoc.msgid = key;
- tdoc.list = list;
- tdoc.domain = domain;
- tdoc.from = msgc->from;
- tdoc.subject = msgc->subject;
- apr_rfc822_date(tdoc.date, msgc->date);
- mbox_indexer_add(indexer, &tdoc);
- }
-
/**
printf("Message Start: %"APR_OFF_T_FMT
"\n\t Body Start: %"APR_OFF_T_FMT
@@ -643,35 +611,35 @@
msgc->body_end - msgc->msg_start);
**/
- msgKey.dptr = (char*) key;
+ msgKey.dptr = (char *) key;
/* We add one to the strlen to encompass the term null */
msgKey.dsize = strlen(key) + 1;
/* We store the entire structure in a single entry. */
- vlen = sizeof(msgc->msg_start) + \
- sizeof(msgc->body_start) + \
- sizeof(msgc->body_end) + \
- sizeof(msgc->date) + \
- sizeof(msgc->cte) + \
- sstrlen(msgc->from) + sizeof(tlen) + \
- sstrlen(msgc->subject) + sizeof(tlen) + \
- sstrlen(msgc->references) + sizeof(tlen) + \
- sstrlen(msgc->content_type) + sizeof(tlen) + \
- sstrlen(msgc->boundary) + sizeof(tlen);
+ vlen = sizeof(msgc->msg_start) +
+ sizeof(msgc->body_start) +
+ sizeof(msgc->body_end) +
+ sizeof(msgc->date) +
+ sizeof(msgc->cte) +
+ sstrlen(msgc->from) + sizeof(tlen) +
+ sstrlen(msgc->subject) + sizeof(tlen) +
+ sstrlen(msgc->references) + sizeof(tlen) +
+ sstrlen(msgc->content_type) + sizeof(tlen) +
+ sstrlen(msgc->boundary) + sizeof(tlen);
value = apr_palloc(pool, vlen);
- memcpy(value+pos, &msgc->msg_start, sizeof(msgc->msg_start));
+ memcpy(value + pos, &msgc->msg_start, sizeof(msgc->msg_start));
pos += sizeof(msgc->msg_start);
- memcpy(value+pos, &msgc->body_start, sizeof(msgc->body_start));
+ memcpy(value + pos, &msgc->body_start, sizeof(msgc->body_start));
pos += sizeof(msgc->body_start);
- memcpy(value+pos, &msgc->body_end, sizeof(msgc->body_end));
+ memcpy(value + pos, &msgc->body_end, sizeof(msgc->body_end));
pos += sizeof(msgc->body_end);
- memcpy(value+pos, &msgc->date, sizeof(msgc->date));
+ memcpy(value + pos, &msgc->date, sizeof(msgc->date));
pos += sizeof(msgc->date);
- memcpy(value+pos, &msgc->cte, sizeof(msgc->cte));
+ memcpy(value + pos, &msgc->cte, sizeof(msgc->cte));
pos += sizeof(msgc->cte);
store_cstring(msgc->from, value, pos, tlen);
@@ -680,7 +648,7 @@
store_cstring(msgc->content_type, value, pos, tlen);
store_cstring(msgc->boundary, value, pos, tlen);
- msgValue.dptr = (char*) value;
+ msgValue.dptr = (char *) value;
msgValue.dsize = pos;
return apr_dbm_store(database, msgKey, msgValue);
@@ -698,21 +666,19 @@
/**
- * This function will generate the appropriate DBM and Lucense Search data
- * fo a given mbox file.
+ * This function will generate the appropriate DBM for a given mbox file.
*/
apr_status_t mbox_generate_index(request_rec *r, apr_file_t *f,
- mbox_indexer_t *indexer, const char* list,
- const char* domain)
+ const char *list, const char *domain)
{
apr_status_t status;
- apr_table_t * table;
+ apr_table_t *table;
apr_dbm_t *msgDB;
- apr_pool_t* tpool;
+ apr_pool_t *tpool;
#ifdef APR_HAS_MMAP
apr_finfo_t fi;
#else
- char buf[HUGE_STRING_LEN+1];
+ char buf[HUGE_STRING_LEN + 1];
#endif
MBOX_BUFF b;
const char *temp, *msgID;
@@ -729,7 +695,7 @@
if (status != APR_SUCCESS)
return status;
- if (fi.size != (apr_size_t)fi.size)
+ if (fi.size != (apr_size_t) fi.size)
return APR_EGENERAL;
if (fi.size == 0) {
@@ -738,7 +704,9 @@
return OK;
}
- status = apr_mmap_create(&b.mm, f, 0, (apr_size_t)fi.size, APR_MMAP_READ, r->pool);
+ status =
+ apr_mmap_create(&b.mm, f, 0, (apr_size_t) fi.size, APR_MMAP_READ,
+ r->pool);
if (status != APR_SUCCESS)
return status;
@@ -763,24 +731,21 @@
apr_pool_create(&tpool, r->pool);
/* When we reach the end of the file, b is NULL. */
- while (b.b)
- {
+ while (b.b) {
#ifdef APR_HAS_MMAP
msgc.body_end = b.b - b.sb;
- /* With mmap, we can hit a file that brings the From check to the very
- * end of the mmap region - hence a dangling pointer (likely SEGV).
- * Therefore, break out of the loop first.
- */
- if (msgc.body_end == b.maxlen) {
- break;
- }
+ /* With mmap, we can hit a file that brings the From check to the very
+ * end of the mmap region - hence a dangling pointer (likely SEGV).
+ * Therefore, break out of the loop first.
+ */
+ if (msgc.body_end == b.maxlen) {
+ break;
+ }
#else
msgc.body_end = b.totalread - b.len + b.b - b.rb;
#endif
if (b.b[0] == 'F' && b.b[1] == 'r' &&
- b.b[2] == 'o' && b.b[3] == 'm' &&
- b.b[4] == ' ')
- {
+ b.b[2] == 'o' && b.b[3] == 'm' && b.b[4] == ' ') {
/**
* The updating of the index is delayed, until we have found
* the next message. This allows the 'current' message to konw
@@ -789,7 +754,7 @@
*/
if (msgID) {
- store_msgc(tpool, msgDB, msgID, &msgc, indexer, list, domain);
+ store_msgc(tpool, msgDB, msgID, &msgc, list, domain);
msgID = NULL;
}
apr_pool_clear(tpool);
@@ -801,7 +766,7 @@
#endif
skipLine(&b);
- table = load_mbox_mime_tables(r,&b);
+ table = load_mbox_mime_tables(r, &b);
/* Location is how much read total minus how much read this pass
* plus the offset of our current position from the last place
@@ -819,8 +784,8 @@
msgc.subject = apr_table_get(table, "Subject");
temp = apr_table_get(table, "Date");
if (temp) {
- /* FIXME: Change this back to apr_date_parse_rfc()
- as soon as it is fixed ! */
+ /* FIXME: Change this back to apr_date_parse_rfc()
+ as soon as it is fixed ! */
msgc.date = mbox_date_parse_rfc(temp);
}
else {
@@ -831,7 +796,7 @@
temp = apr_table_get(table, "Content-Transfer-Encoding");
if (temp) {
- char* p = apr_pstrdup(tpool, temp);
+ char *p = apr_pstrdup(tpool, temp);
msgc.cte = mbox_parse_cte_header(p);
}
else {
@@ -840,7 +805,7 @@
temp = apr_table_get(table, "Content-Type");
if (temp) {
- char* p;
+ char *p;
temp = apr_pstrdup(tpool, temp);
msgc.boundary = mbox_strcasestr(temp, "boundary=");
if (msgc.boundary) {
@@ -869,7 +834,7 @@
}
else {
/* Normalize the Content-Type */
- ex_ap_str_tolower((char*)msgc.content_type);
+ ex_ap_str_tolower((char *) msgc.content_type);
}
}
else {
@@ -887,7 +852,7 @@
* The last message inside the .mbox file is now added to the cache.
*/
if (msgID) {
- store_msgc(tpool, msgDB, msgID, &msgc, indexer, list, domain);
+ store_msgc(tpool, msgDB, msgID, &msgc, list, domain);
}
apr_pool_destroy(tpool);
@@ -911,7 +876,7 @@
apr_datum_t msgKey;
char *temp;
mb_dbm_data msgc;
- apr_pool_t* tpool;
+ apr_pool_t *tpool;
Message *curMsg;
OPEN_DBM(r, msgDB, APR_DBM_READONLY, MSGID_DBM_SUFFIX, temp, status);
@@ -931,10 +896,9 @@
head = 0;
apr_pool_create(&tpool, r->pool);
status = apr_dbm_firstkey(msgDB, &msgKey);
- while (msgKey.dptr != 0 && status == APR_SUCCESS)
- {
+ while (msgKey.dptr != 0 && status == APR_SUCCESS) {
/* Construct a new message */
- curMsg = (Message*)apr_pcalloc(r->pool, sizeof(Message));
+ curMsg = (Message *) apr_pcalloc(r->pool, sizeof(Message));
/* FIXME: When we evolve to MD5 hashes, switch this */
curMsg->msgID = apr_pstrndup(r->pool, msgKey.dptr, msgKey.dsize);
@@ -964,9 +928,9 @@
status = apr_dbm_nextkey(msgDB, &msgKey);
- if (count) {
- (*count)++;
- }
+ if (count) {
+ (*count)++;
+ }
}
apr_pool_destroy(tpool);
@@ -979,7 +943,7 @@
* that may or may not be in the DBM. If it is not in the DBM index,
* NULL will be returned.
*/
-Message* mbox_fetch_index(request_rec *r, apr_file_t *f, const char *msgID)
+Message *mbox_fetch_index(request_rec *r, apr_file_t *f, const char *msgID)
{
apr_status_t status;
apr_dbm_t *msgDB;
@@ -997,12 +961,12 @@
if (status != APR_SUCCESS)
return NULL;
- msgKey.dptr = (char*)msgID;
+ msgKey.dptr = (char *) msgID;
/* We add one to the strlen to encompass the term null */
msgKey.dsize = strlen(msgID) + 1;
/* Construct a new message */
- curMsg = (Message*)apr_pcalloc(r->pool, sizeof(Message));
+ curMsg = (Message *) apr_pcalloc(r->pool, sizeof(Message));
/* FIXME: When we evolve to MD5 hashes, switch this */
curMsg->msgID = apr_pstrndup(r->pool, msgKey.dptr, msgKey.dsize);
@@ -1031,13 +995,13 @@
}
-int mbox_msg_count(request_rec *r, char* path)
+int mbox_msg_count(request_rec *r, char *path)
{
apr_dbm_t *msgDB;
int status;
int count = 0;
apr_datum_t msgKey;
- char* temp;
+ char *temp;
temp = apr_pstrcat(r->pool, r->filename, path, MSGID_DBM_SUFFIX, NULL);
status = apr_dbm_open(&msgDB, temp, APR_DBM_READONLY,
@@ -1051,8 +1015,7 @@
* iterating the keys..
*/
status = apr_dbm_firstkey(msgDB, &msgKey);
- while (msgKey.dptr != 0 && status == APR_SUCCESS)
- {
+ while (msgKey.dptr != 0 && status == APR_SUCCESS) {
count++;
status = apr_dbm_nextkey(msgDB, &msgKey);
}
@@ -1064,14 +1027,14 @@
-static apr_table_t *fetch_first_headers(request_rec* r, apr_file_t* f)
+static apr_table_t *fetch_first_headers(request_rec *r, apr_file_t *f)
{
apr_status_t status;
- apr_table_t* table = NULL;
+ apr_table_t *table = NULL;
#ifdef APR_HAS_MMAP
apr_finfo_t fi;
#else
- char buf[HUGE_STRING_LEN+1];
+ char buf[HUGE_STRING_LEN + 1];
#endif
MBOX_BUFF b;
const char *temp;
@@ -1087,14 +1050,16 @@
if (status != APR_SUCCESS)
return NULL;
- if (fi.size != (apr_size_t)fi.size)
+ if (fi.size != (apr_size_t) fi.size)
return NULL;
/* FIXME: We do not need to mmap the entire file.
* Creating an MMAP is a slow operation on FreeBSD.
* Once created, it is faster than Linux...
*/
- status = apr_mmap_create(&b.mm, f, 0, (apr_size_t)fi.size, APR_MMAP_READ, r->pool);
+ status =
+ apr_mmap_create(&b.mm, f, 0, (apr_size_t) fi.size, APR_MMAP_READ,
+ r->pool);
if (status != APR_SUCCESS)
return NULL;
@@ -1115,12 +1080,11 @@
/* When we reach the end of the file, b is NULL. */
while (b.b) {
if (b.b[0] == 'F' && b.b[1] == 'r' &&
- b.b[2] == 'o' && b.b[3] == 'm' &&
- b.b[4] == ' ') {
+ b.b[2] == 'o' && b.b[3] == 'm' && b.b[4] == ' ') {
skipLine(&b);
- table = load_mbox_mime_tables(r,&b);
+ table = load_mbox_mime_tables(r, &b);
break;
}
}
@@ -1131,12 +1095,12 @@
return table;
}
-char* mbox_get_list_post(request_rec* r, char* path)
+char *mbox_get_list_post(request_rec *r, char *path)
{
apr_status_t rv;
- char* fullpath;
- apr_file_t* f;
- apr_table_t* headers;
+ char *fullpath;
+ apr_file_t *f;
+ apr_table_t *headers;
fullpath = apr_pstrcat(r->pool, r->filename, path, NULL);
@@ -1184,7 +1148,7 @@
* This is why we have RFCs.
*/
-mbox_cte_e mbox_parse_cte_header(char* src)
+mbox_cte_e mbox_parse_cte_header(char *src)
{
ex_ap_str_tolower(src);
if (strstr(src, "bi")) {
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_parse.h
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_parse.h?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_parse.h (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_parse.h Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -35,7 +35,6 @@
#include "apr_strings.h"
#include "apr_mmap.h"
-#include "mbox_search.h"
#include <stdio.h>
#define MBOX_SORT_DATE 0
@@ -58,7 +57,8 @@
*/
typedef struct mbox_buff_struct MBOX_BUFF;
-struct mbox_buff_struct {
+struct mbox_buff_struct
+{
char *sb, *rb, *b;
apr_size_t maxlen, len, totalread;
apr_file_t *fd;
@@ -75,16 +75,18 @@
*/
typedef struct mbox_list_struct MBOX_LIST;
-struct mbox_list_struct{
- MBOX_LIST * next;
+struct mbox_list_struct
+{
+ MBOX_LIST *next;
apr_time_t key;
- void * value;
+ void *value;
};
/*
* All possible Content-Transfer-Encodings.
*/
-typedef enum {
+typedef enum
+{
CTE_NONE = 0,
CTE_7BIT = 1,
CTE_8BIT = 2,
@@ -94,7 +96,7 @@
CTE_BASE64 = 6,
} mbox_cte_e;
-mbox_cte_e mbox_parse_cte_header(char* src);
+mbox_cte_e mbox_parse_cte_header(char *src);
/* The following is based on Jamie Zawinski's description of the Netscape 3.x
* threading algorithm at <http://www.jwz.org/doc/threading.html>.
@@ -103,7 +105,7 @@
/* As JWZ says, this shouldn't be char*, but something that could be
* derived from an MD5 hash. That can come later.
*/
-typedef char* ID;
+typedef char *ID;
/* Typedefs for Message and Container */
typedef struct Message_Struct Message;
@@ -159,10 +161,10 @@
/* The threading information about a message. */
struct Container_Struct
{
- Message* message;
- Container* parent; /* Only one parent */
- Container* child; /* Many children */
- Container* next; /* Many siblings */
+ Message *message;
+ Container *parent; /* Only one parent */
+ Container *child; /* Many children */
+ Container *next; /* Many siblings */
};
/*
@@ -178,30 +180,29 @@
/*
* Sorts a list of MBOX_LIST items by the specified order.
*/
-MBOX_LIST* mbox_sort_list(MBOX_LIST* l, int sortFlags);
+MBOX_LIST *mbox_sort_list(MBOX_LIST *l, int sortFlags);
/*
* Generates the DBM file.
*/
-apr_status_t mbox_generate_index(request_rec *r, apr_file_t * f,
- mbox_indexer_t *indexer, const char* list,
- const char* domain);
+apr_status_t mbox_generate_index(request_rec *r, apr_file_t *f,
+ const char *list, const char *domain);
/*
* Returns a list of Messages
*/
-MBOX_LIST* mbox_load_index(request_rec *r, apr_file_t *f, int *count);
+MBOX_LIST *mbox_load_index(request_rec *r, apr_file_t *f, int *count);
/*
* Returns a single message based on message ID
*/
-Message* mbox_fetch_index(request_rec *r, apr_file_t * f, const char * msgID);
+Message *mbox_fetch_index(request_rec *r, apr_file_t *f, const char *msgID);
/*
* Get the total message count for a file.
*/
-int mbox_msg_count(request_rec *r, char* path);
+int mbox_msg_count(request_rec *r, char *path);
-char* mbox_get_list_post(request_rec *r, char* path);
+char *mbox_get_list_post(request_rec *r, char *path);
#endif
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_sort.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_sort.c?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_sort.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_sort.c Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -34,7 +34,8 @@
* @param pcount Pointer to a long that may contain the count
*/
void *mbox_sort_linked_list(void *p, unsigned index,
- int (*compare)(void *, void *, void *), void *pointer, unsigned long *pcount)
+ int (*compare) (void *, void *, void *),
+ void *pointer, unsigned long *pcount)
{
unsigned base;
unsigned long block_size;
@@ -56,11 +57,10 @@
tape[0].count = tape[1].count = 0L;
tape[0].first = NULL;
base = 0;
- while (p != NULL)
- {
- struct record *next = ((struct record *)p)->next[index];
- ((struct record *)p)->next[index] = tape[base].first;
- tape[base].first = ((struct record *)p);
+ while (p != NULL) {
+ struct record *next = ((struct record *) p)->next[index];
+ ((struct record *) p)->next[index] = tape[base].first;
+ tape[base].first = ((struct record *) p);
tape[base].count++;
p = next;
base ^= 1;
@@ -69,43 +69,36 @@
/* If the list is empty or contains only a single record, then */
/* tape[1].count == 0L and this part is vacuous. */
- for (base = 0, block_size = 1L; tape[base+1].count != 0L;
- base ^= 2, block_size <<= 1)
- {
+ for (base = 0, block_size = 1L; tape[base + 1].count != 0L;
+ base ^= 2, block_size <<= 1) {
int dest;
struct tape *tape0, *tape1;
tape0 = tape + base;
tape1 = tape + base + 1;
dest = base ^ 2;
- tape[dest].count = tape[dest+1].count = 0;
- for (; tape0->count != 0; dest ^= 1)
- {
+ tape[dest].count = tape[dest + 1].count = 0;
+ for (; tape0->count != 0; dest ^= 1) {
unsigned long n0, n1;
struct tape *output_tape = tape + dest;
n0 = n1 = block_size;
- while (1)
- {
+ while (1) {
struct record *chosen_record;
struct tape *chosen_tape;
- if (n0 == 0 || tape0->count == 0)
- {
+ if (n0 == 0 || tape0->count == 0) {
if (n1 == 0 || tape1->count == 0)
break;
chosen_tape = tape1;
n1--;
}
- else if (n1 == 0 || tape1->count == 0)
- {
+ else if (n1 == 0 || tape1->count == 0) {
chosen_tape = tape0;
n0--;
}
- else if ((*compare)(tape0->first, tape1->first, pointer) > 0)
- {
+ else if ((*compare) (tape0->first, tape1->first, pointer) > 0) {
chosen_tape = tape1;
n1--;
}
- else
- {
+ else {
chosen_tape = tape0;
n0--;
}
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_sort.h
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_sort.h?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_sort.h (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_sort.h Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -18,7 +18,7 @@
#define MBOX_SORT_H
void *mbox_sort_linked_list(void *p, unsigned index,
- int (*compare)(void *, void *, void *), void *pointer,
- unsigned long *pcount);
+ int (*compare) (void *, void *, void *),
+ void *pointer, unsigned long *pcount);
#endif
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_thread.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_thread.c?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_thread.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_thread.c Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -28,17 +28,14 @@
int is_reply_string(char *c)
{
/* Match the following cases: Re:, RE:, RE[1]:, Re: Re[2]: Re: */
- if (c)
- {
- if ((c[0] == 'R') && (c[1] == 'E' || c[1] == 'e'))
- {
+ if (c) {
+ if ((c[0] == 'R') && (c[1] == 'E' || c[1] == 'e')) {
if (c[2] == ':')
return 1;
- else if (c[2] == '[')
- {
+ else if (c[2] == '[') {
c = c + 3;
- while(apr_isdigit(*c))
+ while (apr_isdigit(*c))
c++;
if (*c == ']')
@@ -60,23 +57,21 @@
/*
* Strips all of the RE: junk from the subject line.
*/
-char* strip_subject(apr_pool_t *p, Message *m)
+char *strip_subject(apr_pool_t *p, Message *m)
{
char *newVal = m->subject, *match = m->subject, *tmp = 0;
/* Match the following cases: Re:, RE:, RE[1]:, Re: Re[2]: Re: */
- while (match && *match)
- {
+ while (match && *match) {
/* When we don't have a match, tmp contains the "real" subject. */
tmp = newVal = match;
match = 0;
- if (*newVal == 'R' && (*++newVal == 'e' || *newVal == 'E'))
- {
+ if (*newVal == 'R' && (*++newVal == 'e' || *newVal == 'E')) {
/* Note to self. In pure compressed syntax, the famous dangling
* else occurs. Oh, well. */
- if (*++newVal == '[')
- {
- while (apr_isdigit(*++newVal)) {}
+ if (*++newVal == '[') {
+ while (apr_isdigit(*++newVal)) {
+ }
if (*++newVal == ']' && *++newVal == ':')
match = ++newVal;
}
@@ -119,8 +114,7 @@
if (c->parent->child == c)
c->parent->child = c->next;
- else
- {
+ else {
next = c->parent->child;
/* If we go past the end of the list,
@@ -139,12 +133,9 @@
lastChild = NULL;
nextChild = c->child;
- while (nextChild)
- {
- if (!nextChild->message)
- {
- while (nextChild->child) /* Promote children to this level */
- {
+ while (nextChild) {
+ if (!nextChild->message) {
+ while (nextChild->child) { /* Promote children to this level */
/* Save what would be our next child to visit */
tmpChild = nextChild->child->next;
@@ -162,8 +153,7 @@
else
c->child = nextChild->next;
}
- else
- {
+ else {
prune_container(nextChild);
lastChild = nextChild;
@@ -183,8 +173,7 @@
return;
next = r->child;
- while(next)
- {
+ while (next) {
tmp = next;
next = next->next;
tmp->next = l->child;
@@ -209,20 +198,18 @@
/*
* Takes two containers and returns them as one with sibling relationship.
*/
-Container* merge_container(apr_pool_t *p, Container *l, Container *r)
+Container *merge_container(apr_pool_t *p, Container *l, Container *r)
{
Container *c, *next;
- c = (Container*) apr_pcalloc(p, sizeof(Container));
+ c = (Container *) apr_pcalloc(p, sizeof(Container));
r->parent = c;
l->parent = c;
/* Update parents of siblings */
- if (r->next)
- {
+ if (r->next) {
next = r->next;
- while (next)
- {
+ while (next) {
next->parent = c;
next = next->next;
}
@@ -230,11 +217,9 @@
if (!l->next)
l->next = r;
- else
- {
+ else {
next = l->next;
- while (next->next)
- {
+ while (next->next) {
next->parent = c;
next = next->next;
}
@@ -254,11 +239,9 @@
apr_size_t hashLen;
for (hashIndex = apr_hash_first(p, h); hashIndex;
- hashIndex = apr_hash_next(hashIndex))
- {
- apr_hash_this(hashIndex, (void*) &hashKey, &hashLen, &hashVal);
- if (hashVal == i)
- {
+ hashIndex = apr_hash_next(hashIndex)) {
+ apr_hash_this(hashIndex, (void *) &hashKey, &hashLen, &hashVal);
+ if (hashVal == i) {
apr_hash_set(h, hashKey, hashLen, NULL);
return;
}
@@ -270,8 +253,8 @@
*/
int compare_siblings(void *p, void *q, void *pointer)
{
- Container *a = (Container*)p;
- Container *b = (Container*)q;
+ Container *a = (Container *) p;
+ Container *b = (Container *) q;
/* The definition of the containers give us the following rules. */
if (!a->message)
@@ -285,27 +268,26 @@
/*
* Sorts the siblings by date and returns the first item in the list.
*/
-Container* sort_siblings(Container *c)
+Container *sort_siblings(Container *c)
{
Container *sibling = c;
/* We need to sort all of our siblings' children */
- while (sibling)
- {
+ while (sibling) {
if (sibling->child)
sibling->child = sort_siblings(sibling->child);
sibling = sibling->next;
}
/* Sort us and our siblings */
- return (Container*) mbox_sort_linked_list(c, 3, compare_siblings,
- NULL, NULL);
+ return (Container *) mbox_sort_linked_list(c, 3, compare_siblings,
+ NULL, NULL);
}
/*
* Calculates the threading relationships for a list of messages
*/
-Container* calculate_threads(apr_pool_t *p, MBOX_LIST *l)
+Container *calculate_threads(apr_pool_t *p, MBOX_LIST *l)
{
apr_hash_t *h, *rootSet, *subjectSet;
apr_hash_index_t *hashIndex;
@@ -322,18 +304,15 @@
/* FIXME: Use APR_HASH_KEY_STRING instead? Maybe slower. */
h = apr_hash_make(p);
- while (current != NULL)
- {
- m = (Message*)current->value;
+ while (current != NULL) {
+ m = (Message *) current->value;
msgIDLen = strlen(m->msgID);
- c = (Container*)apr_hash_get(h, m->msgID, msgIDLen);
- if (c)
- {
+ c = (Container *) apr_hash_get(h, m->msgID, msgIDLen);
+ if (c) {
c->message = m;
}
- else
- {
- c = (Container*) apr_pcalloc(p, sizeof(Container));
+ else {
+ c = (Container *) apr_pcalloc(p, sizeof(Container));
c->message = m;
c->parent = NULL;
c->child = NULL;
@@ -345,19 +324,20 @@
if (m->references) {
refHdr = apr_table_elts(m->references);
- refEnt = (apr_table_entry_t *)refHdr->elts;
+ refEnt = (apr_table_entry_t *) refHdr->elts;
for (i = 0; i < refHdr->nelts; i++) {
refLen = strlen(refEnt[i].key);
- curParent = (Container*) apr_hash_get(h, refEnt[i].key, refLen);
+ curParent =
+ (Container *) apr_hash_get(h, refEnt[i].key, refLen);
/* Create a dummy node to store the message we haven't
* yet seen. */
- if (!curParent)
- {
- curParent = (Container*) apr_pcalloc(p, sizeof(Container));
+ if (!curParent) {
+ curParent =
+ (Container *) apr_pcalloc(p, sizeof(Container));
apr_hash_set(h, refEnt[i].key, refLen, curParent);
}
@@ -366,8 +346,7 @@
*/
if (realParent &&
!detect_loop(curParent, realParent) &&
- !detect_loop(realParent, curParent))
- {
+ !detect_loop(realParent, curParent)) {
/* Update the parent */
if (curParent->parent)
unlink_parent(curParent);
@@ -385,8 +364,7 @@
/* The last parent we saw is our parent UNLESS it causes a loop. */
if (realParent && !detect_loop(c, realParent) &&
- !detect_loop(realParent, c))
- {
+ !detect_loop(realParent, c)) {
/* We need to unlink our parent's link to us. */
if (c->parent)
unlink_parent(c);
@@ -403,20 +381,18 @@
rootSet = apr_hash_make(p);
for (hashIndex = apr_hash_first(p, h); hashIndex;
- hashIndex = apr_hash_next(hashIndex))
- {
- apr_hash_this(hashIndex, (void*) &hashKey, &hashLen, &hashVal);
- c = (Container*)hashVal;
+ hashIndex = apr_hash_next(hashIndex)) {
+ apr_hash_this(hashIndex, (void *) &hashKey, &hashLen, &hashVal);
+ c = (Container *) hashVal;
if (!c->parent)
apr_hash_set(rootSet, hashKey, hashLen, c);
}
/* Prune empty containers */
for (hashIndex = apr_hash_first(p, rootSet); hashIndex;
- hashIndex = apr_hash_next(hashIndex))
- {
- apr_hash_this(hashIndex, (void*) &hashKey, &hashLen, &hashVal);
- c = (Container*)hashVal;
+ hashIndex = apr_hash_next(hashIndex)) {
+ apr_hash_this(hashIndex, (void *) &hashKey, &hashLen, &hashVal);
+ c = (Container *) hashVal;
prune_container(c);
@@ -428,10 +404,9 @@
subjectSet = apr_hash_make(p);
for (hashIndex = apr_hash_first(p, rootSet); hashIndex;
- hashIndex = apr_hash_next(hashIndex))
- {
- apr_hash_this(hashIndex, (void*) &hashKey, &hashLen, &hashVal);
- c = (Container*)hashVal;
+ hashIndex = apr_hash_next(hashIndex)) {
+ apr_hash_this(hashIndex, (void *) &hashKey, &hashLen, &hashVal);
+ c = (Container *) hashVal;
/* If we don't have a message, our child will. */
if (!c->message)
@@ -442,15 +417,14 @@
/* FIXME: Match what JWZ says */
subjectVal = apr_hash_get(subjectSet, subject, subjectLen);
- if (subjectVal)
- {
+ if (subjectVal) {
if (!c->message)
apr_hash_set(subjectSet, subject, strlen(subject), hashVal);
- else
- {
- subjectPair = (Container*)subjectVal;
+ else {
+ subjectPair = (Container *) subjectVal;
if (!is_reply(c->message) && is_reply(subjectPair->message))
- apr_hash_set(subjectSet, subject, strlen(subject), hashVal);
+ apr_hash_set(subjectSet, subject, strlen(subject),
+ hashVal);
}
}
else
@@ -459,10 +433,9 @@
/* Subject table now populated */
for (hashIndex = apr_hash_first(p, rootSet); hashIndex;
- hashIndex = apr_hash_next(hashIndex))
- {
- apr_hash_this(hashIndex, (void*) &hashKey, &hashLen, &hashVal);
- c = (Container*)hashVal;
+ hashIndex = apr_hash_next(hashIndex)) {
+ apr_hash_this(hashIndex, (void *) &hashKey, &hashLen, &hashVal);
+ c = (Container *) hashVal;
/* If we don't have a message, our child will. */
if (c->message)
@@ -473,42 +446,38 @@
subjectLen = strlen(subject);
subjectVal = apr_hash_get(subjectSet, subject, subjectLen);
- subjectPair = (Container*)subjectVal;
+ subjectPair = (Container *) subjectVal;
/* If we need to merge the tables */
- if (subjectPair && subjectPair != c)
- {
- if (!c->message || !subjectPair->message) /* One is dummy */
- {
+ if (subjectPair && subjectPair != c) {
+ if (!c->message || !subjectPair->message) { /* One is dummy */
if (!c->message && !subjectPair->message)
join_container(subjectPair, c);
- else if (c->message && !subjectPair->message)
- {
+ else if (c->message && !subjectPair->message) {
/* It's possible that we're already a child! */
if (c->parent != subjectPair)
append_container(subjectPair, c);
}
- else /* (!c->message && subjectPair->message) */
- {
+ else { /* (!c->message && subjectPair->message) */
+
append_container(c, subjectPair);
apr_hash_set(subjectSet, subject, subjectLen, c);
delete_from_hash(p, rootSet, subjectPair);
}
}
- else /* Both aren't dummies */
- {
+ else { /* Both aren't dummies */
+
/* We are Reply */
if (is_reply(c->message) && !is_reply(subjectPair->message))
append_container(subjectPair, c);
else if (!is_reply(c->message) &&
- is_reply(subjectPair->message))
- {
+ is_reply(subjectPair->message)) {
append_container(c, subjectPair);
apr_hash_set(subjectSet, subject, subjectLen, c);
delete_from_hash(p, rootSet, subjectPair);
}
- else /* We are both replies. */
- {
+ else { /* We are both replies. */
+
c = merge_container(p, c, subjectPair);
apr_hash_set(subjectSet, subject, subjectLen, c);
delete_from_hash(p, rootSet, subjectPair);
@@ -524,10 +493,9 @@
tmp = NULL;
/* Sort siblings */
for (hashIndex = apr_hash_first(p, subjectSet); hashIndex;
- hashIndex = apr_hash_next(hashIndex))
- {
- apr_hash_this(hashIndex, (void*) &hashKey, &hashLen, &hashVal);
- c = (Container*)hashVal;
+ hashIndex = apr_hash_next(hashIndex)) {
+ apr_hash_this(hashIndex, (void *) &hashKey, &hashLen, &hashVal);
+ c = (Container *) hashVal;
sort_siblings(c);
@@ -536,5 +504,6 @@
tmp = c;
}
- return (Container*) mbox_sort_linked_list(tmp, 3, compare_siblings, NULL, NULL);
+ return (Container *) mbox_sort_linked_list(tmp, 3, compare_siblings, NULL,
+ NULL);
}
Modified: httpd/mod_mbox/trunk/module-2.0/mbox_thread.h
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_thread.h?rev=729600&r1=729599&r2=729600&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_thread.h (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_thread.h Fri Dec 26 21:27:52 2008
@@ -1,9 +1,9 @@
-/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -21,6 +21,6 @@
#include "apr_pools.h"
#include "mbox_parse.h"
-Container* calculate_threads(apr_pool_t *p, MBOX_LIST *l);
+Container *calculate_threads(apr_pool_t *p, MBOX_LIST *l);
#endif