[svn-commits] ivaxer: branch ivaxer/ast_storage r267540 - in /team/ivaxer/ast_storage: incl...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 3 12:46:43 CDT 2010


Author: ivaxer
Date: Thu Jun  3 12:46:39 2010
New Revision: 267540

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=267540
Log:
Exported ast_exts_compare function from file.c

Modified:
    team/ivaxer/ast_storage/include/asterisk/file.h
    team/ivaxer/ast_storage/main/file.c

Modified: team/ivaxer/ast_storage/include/asterisk/file.h
URL: http://svnview.digium.com/svn/asterisk/team/ivaxer/ast_storage/include/asterisk/file.h?view=diff&rev=267540&r1=267539&r2=267540
==============================================================================
--- team/ivaxer/ast_storage/include/asterisk/file.h (original)
+++ team/ivaxer/ast_storage/include/asterisk/file.h Thu Jun  3 12:46:39 2010
@@ -336,6 +336,15 @@
  */
 char *ast_format_str_reduce(char *fmts);
 
+/*! Compare type against the list */
+/*!
+ * \param exts a string with formats separated by '|'
+ * \param type a format to compare
+ * \retval 1 on successful comparing
+ * \retval 0 on not success
+ */
+int ast_exts_compare(const char *exts, const char *type);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/ivaxer/ast_storage/main/file.c
URL: http://svnview.digium.com/svn/asterisk/team/ivaxer/ast_storage/main/file.c?view=diff&rev=267540&r1=267539&r2=267540
==============================================================================
--- team/ivaxer/ast_storage/main/file.c (original)
+++ team/ivaxer/ast_storage/main/file.c Thu Jun  3 12:46:39 2010
@@ -207,6 +207,22 @@
 	return res;
 }
 
+/* compare type against the list 'exts' */
+/* XXX need a better algorithm */
+int ast_exts_compare(const char *exts, const char *type)
+{
+	char tmp[256];
+	char *stringp = tmp, *ext;
+
+	ast_copy_string(tmp, exts, sizeof(tmp));
+	while ((ext = strsep(&stringp, "|"))) {
+		if (!strcmp(ext, type))
+			return 1;
+	}
+
+	return 0;
+}
+
 static int copy(const char *infile, const char *outfile)
 {
 	int ifd, ofd, len;
@@ -270,22 +286,6 @@
 		}
 	}
 	return fn;
-}
-
-/* compare type against the list 'exts' */
-/* XXX need a better algorithm */
-static int exts_compare(const char *exts, const char *type)
-{
-	char tmp[256];
-	char *stringp = tmp, *ext;
-
-	ast_copy_string(tmp, exts, sizeof(tmp));
-	while ((ext = strsep(&stringp, "|"))) {
-		if (!strcmp(ext, type))
-			return 1;
-	}
-
-	return 0;
 }
 
 static void filestream_destructor(void *arg)
@@ -416,7 +416,7 @@
 	AST_RWLIST_TRAVERSE(&formats, f, list) {
 		char *stringp, *ext = NULL;
 
-		if (fmt && !exts_compare(f->exts, fmt))
+		if (fmt && !ast_exts_compare(f->exts, fmt))
 			continue;
 
 		/* Look for a file matching the supported extensions.
@@ -991,7 +991,7 @@
 
 	AST_RWLIST_TRAVERSE(&formats, f, list) {
 		fs = NULL;
-		if (!exts_compare(f->exts, type))
+		if (!ast_exts_compare(f->exts, type))
 			continue;
 		else 
 			format_found = 1;
@@ -1058,7 +1058,7 @@
 		if (fs)
 			break;
 
-		if (!exts_compare(f->exts, type))
+		if (!ast_exts_compare(f->exts, type))
 			continue;
 		else
 			format_found = 1;
@@ -1369,7 +1369,7 @@
 
 	for (x = 0; (type = strsep(&stringp, "|")) && x < AST_MAX_FORMATS; x++) {
 		AST_RWLIST_TRAVERSE(&formats, f, list) {
-			if (exts_compare(f->exts, type)) {
+			if (ast_exts_compare(f->exts, type)) {
 				found = 1;
 				break;
 			}




More information about the svn-commits mailing list