httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1566264 - in /httpd/mod_mbox/trunk/module-2.0: mbox_cache.c mbox_dbm.h mbox_parse.c
Date Sun, 09 Feb 2014 10:20:07 GMT
Author: rjung
Date: Sun Feb  9 10:20:07 2014
New Revision: 1566264

URL: http://svn.apache.org/r1566264
Log:
Use chosen dbm type also for listinfo dbm files.

Added:
    httpd/mod_mbox/trunk/module-2.0/mbox_dbm.h
Modified:
    httpd/mod_mbox/trunk/module-2.0/mbox_cache.c
    httpd/mod_mbox/trunk/module-2.0/mbox_parse.c

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=1566264&r1=1566263&r2=1566264&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_cache.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_cache.c Sun Feb  9 10:20:07 2014
@@ -19,9 +19,15 @@
  * This includes the list name, the domain, and the message count for each month.
  */
 #include "mbox_cache.h"
+#include "mbox_dbm.h"
 
 #define LIST_DB_NAME "listinfo.db"
 
+#define OPEN_DBM(pool, mli, flags, path, temp, status) \
+    temp = apr_pstrcat(pool, path, "/", LIST_DB_NAME, NULL); \
+    mli = apr_palloc(pool, sizeof(mbox_cache_info)); \
+    status = apr_dbm_open_ex(&mli->db, APR_STRINGIFY(DBM_TYPE), temp, flags, APR_OS_DEFAULT,
pool);
+
 static char *str_cache_version = "_cache_version";
 static char *str_cache_mtime = "_cache_mtime";
 static char *str_cache_list = "_cache_list";
@@ -68,16 +74,10 @@ APR_DECLARE(apr_status_t)
     int update_only = 0;
     int tver;
 
-    temp = apr_pstrcat(pool, path, "/", LIST_DB_NAME, NULL);
-
-    mli = apr_palloc(pool, sizeof(mbox_cache_info));
-
-    rv = apr_dbm_open(&mli->db, temp, APR_DBM_READWRITE,
-                      APR_OS_DEFAULT, pool);
+    OPEN_DBM(pool, mli, APR_DBM_READWRITE, path, temp, rv);
 
     if (rv != APR_SUCCESS) {
-        rv = apr_dbm_open(&mli->db, temp, APR_DBM_RWCREATE,
-                          APR_OS_DEFAULT, pool);
+        OPEN_DBM(pool, mli, APR_DBM_RWCREATE, path, temp, rv);
 
         mli->mtime = 0;
         if (rv != APR_SUCCESS) {
@@ -163,11 +163,7 @@ APR_DECLARE(apr_status_t)
     int tver;
     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);
+    OPEN_DBM(p, mli, APR_DBM_READONLY, path, temp, rv);
 
     if (rv != APR_SUCCESS) {
         return rv;

Added: httpd/mod_mbox/trunk/module-2.0/mbox_dbm.h
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_dbm.h?rev=1566264&view=auto
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_dbm.h (added)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_dbm.h Sun Feb  9 10:20:07 2014
@@ -0,0 +1,30 @@
+/* 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.
+ */
+
+#ifndef MBOX_DBM_H
+#define MBOX_DBM_H
+
+/*
+ * Data structures and header files needed for dbm handling.
+ */
+
+#define CORE_PRIVATE
+
+#ifndef DBM_TYPE
+#define DBM_TYPE default
+#endif
+
+#endif

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=1566264&r1=1566263&r2=1566264&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_parse.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_parse.c Sun Feb  9 10:20:07 2014
@@ -33,6 +33,7 @@
 
 #include "mbox_parse.h"
 #include "mbox_sort.h"
+#include "mbox_dbm.h"
 
 /* FIXME: Remove this when apr_date_parse_rfc() and ap_strcasestr() are fixed ! */
 #include "mbox_externals.h"
@@ -45,13 +46,9 @@
 /* for dirname() */
 #include <libgen.h>
 
-#ifndef DBM_TYPE
-#define DBM_TYPE default
-#endif
-
 #define OPEN_DBM(r, db, flags, suffix, temp, status) \
     temp = apr_pstrcat(r->pool, r->filename, suffix, NULL); \
-    status = apr_dbm_open_ex(&db, APR_STRINGIFY(DBM_TYPE), temp, flags, APR_OS_DEFAULT,
r->pool );
+    status = apr_dbm_open_ex(&db, APR_STRINGIFY(DBM_TYPE), temp, flags, APR_OS_DEFAULT,
r->pool);
 
 #define MSGID_DBM_SUFFIX ".msgsum"
 



Mime
View raw message