[asterisk-commits] ivaxer: branch ivaxer/ast_storage r282429 - in /team/ivaxer/ast_storage: incl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 16 07:01:03 CDT 2010


Author: ivaxer
Date: Mon Aug 16 07:00:52 2010
New Revision: 282429

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=282429
Log:
changed prototype of "release"-functions.

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

Modified: team/ivaxer/ast_storage/include/asterisk/storage.h
URL: http://svnview.digium.com/svn/asterisk/team/ivaxer/ast_storage/include/asterisk/storage.h?view=diff&rev=282429&r1=282428&r2=282429
==============================================================================
--- team/ivaxer/ast_storage/include/asterisk/storage.h (original)
+++ team/ivaxer/ast_storage/include/asterisk/storage.h Mon Aug 16 07:00:52 2010
@@ -208,9 +208,10 @@
 
 /*! \brief Releases fileobject
  * \param fo File object to release
- * \return Nothing.
- */
-void ast_storage_fileobject_release(struct ast_storage_fileobject *fo);
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_storage_fileobject_release(struct ast_storage_fileobject *fo);
 
 /*! \brief Creates new file instance
  * \retval non-NULL Success
@@ -221,9 +222,10 @@
 
 /*! \brief Releasesfile instance
  * \param fi File instance to release
- * \return Nothing.
- */
-void ast_storage_fileinst_release(struct ast_storage_fileinst *fi);
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_storage_fileinst_release(struct ast_storage_fileinst *fi);
 
 /*! \brief Creates a new list of fileobjects
  * \retval non-NULL Success
@@ -234,9 +236,10 @@
 
 /*! \brief Releases list of fileobjects
  * \param fobjs Head of list of fileobjects
- * \return Nothing.
- */
-void ast_storage_fileobjects_release(struct ast_storage_fileobjects *fobjs);
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_storage_fileobjects_release(struct ast_storage_fileobjects *fobjs);
 
 /*! \brief Opens file instance
  * \param fi File instance to open

Modified: team/ivaxer/ast_storage/main/storage.c
URL: http://svnview.digium.com/svn/asterisk/team/ivaxer/ast_storage/main/storage.c?view=diff&rev=282429&r1=282428&r2=282429
==============================================================================
--- team/ivaxer/ast_storage/main/storage.c (original)
+++ team/ivaxer/ast_storage/main/storage.c Mon Aug 16 07:00:52 2010
@@ -235,30 +235,34 @@
 	return fo;
 }
 
-void ast_storage_fileobject_release(struct ast_storage_fileobject *fo)
+int ast_storage_fileobject_release(struct ast_storage_fileobject *fo)
 {
 	struct ast_storage_fileinst *inst;
 
 	if (!fo) {
-		return;
+		return -1;
 	}
 
 	if (fo->metadata) {
-		ast_storage_fileinst_release(fo->metadata);
+		return ast_storage_fileinst_release(fo->metadata);
 	}
 
 	if (!AST_RWLIST_WRLOCK(&fo->files)) {
 		ast_log(LOG_WARNING, "Unable to lock file instances list\n");
-		return;
+		return -1;
 	}
 
 	while ((inst = AST_RWLIST_REMOVE_HEAD(&fo->files, list))) {
-		ast_storage_fileinst_release(inst);
+		if (!ast_storage_fileinst_release(inst)) {
+			AST_RWLIST_UNLOCK(&fo->files);
+			return -1;
+		}
 	}
 
 	AST_RWLIST_UNLOCK(&fo->files);
 
 	ast_free(fo);
+	return 0;
 }
 
 struct ast_storage_fileinst *ast_storage_fileinst_create(void)
@@ -272,10 +276,10 @@
 	return fi;
 }
 
-void ast_storage_fileinst_release(struct ast_storage_fileinst *fi)
+int ast_storage_fileinst_release(struct ast_storage_fileinst *fi)
 {
 	if (!fi) {
-		return;
+		return -1;
 	}
 
 	if (fi->fd != -1) {
@@ -287,6 +291,7 @@
 	}
 
 	ast_free(fi);
+	return 0;
 }
 
 struct ast_storage_fileobjects *ast_storage_fileobjects_create(void)
@@ -300,26 +305,30 @@
 	return fobjs;
 }
 
-void ast_storage_fileobjects_release(struct ast_storage_fileobjects *fobjs)
+int ast_storage_fileobjects_release(struct ast_storage_fileobjects *fobjs)
 {
 	struct ast_storage_fileobject *fo;
 
 	if (!fobjs) {
-		return;
+		return -1;
 	}
 
 	if (!AST_RWLIST_WRLOCK(fobjs)) {
 		ast_log(LOG_WARNING, "Unable to lock fileobjects list\n");
-		return;
+		return -1;
 	}
 
 	while ((fo = AST_RWLIST_REMOVE_HEAD(fobjs, list))) {
-		ast_storage_fileobject_release(fo);
+		if (!ast_storage_fileobject_release(fo)) {
+			AST_RWLIST_UNLOCK(fobjs);
+			return -1;
+		}
 	}
 
 	AST_RWLIST_UNLOCK(fobjs);
 
 	ast_free(fobjs);
+	return 0;
 }
 
 #if 0




More information about the asterisk-commits mailing list