[asterisk-commits] tilghman: trunk r102602 - in /trunk: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 5 21:05:01 CST 2008


Author: tilghman
Date: Tue Feb  5 21:05:00 2008
New Revision: 102602

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102602
Log:
Merged revisions 102576 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r102576 | tilghman | 2008-02-05 18:26:02 -0600 (Tue, 05 Feb 2008) | 4 lines

Move around some defines to unbreak ODBC storage.
(closes issue #11932)
 Reported by: snuffy

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_voicemail.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=102602&r1=102601&r2=102602
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Tue Feb  5 21:05:00 2008
@@ -1626,6 +1626,41 @@
 }
 #endif
 
+#ifndef IMAP_STORAGE
+/*! \brief
+ * A negative return value indicates an error.
+ * \note Should always be called with a lock already set on dir.
+ */
+static int last_message_index(struct ast_vm_user *vmu, char *dir)
+{
+	int x;
+	unsigned char map[MAXMSGLIMIT] = "";
+	DIR *msgdir;
+	struct dirent *msgdirent;
+	int msgdirint;
+
+	/* Reading the entire directory into a file map scales better than
+	 * doing a stat repeatedly on a predicted sequence.  I suspect this
+	 * is partially due to stat(2) internally doing a readdir(2) itself to
+	 * find each file. */
+	msgdir = opendir(dir);
+	while ((msgdirent = readdir(msgdir))) {
+		if (sscanf(msgdirent->d_name, "msg%d", &msgdirint) == 1 && msgdirint < MAXMSGLIMIT)
+			map[msgdirint] = 1;
+	}
+	closedir(msgdir);
+
+	for (x = 0; x < vmu->maxmsg; x++) {
+		if (map[x] == 0)
+			break;
+	}
+
+	return x - 1;
+}
+
+#endif /*#ifndef IMAP_STORAGE*/
+#endif /*#else of #ifdef ODBC_STORAGE*/
+
 static int copy(char *infile, char *outfile)
 {
 	int ifd;
@@ -1718,41 +1753,6 @@
 	ast_variables_destroy(var);
 }
 
-#ifndef IMAP_STORAGE
-/*! \brief
- * A negative return value indicates an error.
- * \note Should always be called with a lock already set on dir.
- */
-static int last_message_index(struct ast_vm_user *vmu, char *dir)
-{
-	int x;
-	unsigned char map[MAXMSGLIMIT] = "";
-	DIR *msgdir;
-	struct dirent *msgdirent;
-	int msgdirint;
-
-	/* Reading the entire directory into a file map scales better than
-	 * doing a stat repeatedly on a predicted sequence.  I suspect this
-	 * is partially due to stat(2) internally doing a readdir(2) itself to
-	 * find each file. */
-	msgdir = opendir(dir);
-	while ((msgdirent = readdir(msgdir))) {
-		if (sscanf(msgdirent->d_name, "msg%d", &msgdirint) == 1 && msgdirint < MAXMSGLIMIT)
-			map[msgdirint] = 1;
-	}
-	closedir(msgdir);
-
-	for (x = 0; x < vmu->maxmsg; x++) {
-		if (map[x] == 0)
-			break;
-	}
-
-	return x - 1;
-}
-
-#endif /*#ifndef IMAP_STORAGE*/
-#endif /*#else of #ifdef ODBC_STORAGE*/
-#ifndef ODBC_STORAGE
 static int vm_delete(char *file)
 {
 	char *txt;
@@ -1770,7 +1770,6 @@
 	unlink(txt);
 	return ast_filedelete(file, NULL);
 }
-#endif
 
 static int inbuf(struct baseio *bio, FILE *fi)
 {
@@ -4521,7 +4520,7 @@
 		}
 
 		/* Remove surrogate file */
-		DELETE(tmpdir, curmsg, msgfile);
+		vm_delete(msgfile);
 	}
 
 	/* If anything failed above, we still have this list to free */




More information about the asterisk-commits mailing list