[libdvdnav-devel] [PATCH 10/33] Deprecate ifoFree_PTL_MAIT()

beandog at gentoo.org beandog at gentoo.org
Thu Jan 15 21:45:22 CET 2015


From: Steve Dibb <steve.dibb at gmail.com>

---
 src/dvdread/ifo_read.h |  2 +-
 src/ifo_read.c         | 27 +++++++++++++--------------
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/dvdread/ifo_read.h b/src/dvdread/ifo_read.h
index 4cd007f..7a9e633 100644
--- a/src/dvdread/ifo_read.h
+++ b/src/dvdread/ifo_read.h
@@ -209,7 +209,6 @@ int ifoRead_TXTDT_MGI(ifo_handle_t *);
  * below are safe:  they will not mind if you attempt to free part of an IFO
  * file which was not read in or which does not exist.
  */
-void ifoFree_PTL_MAIT(ifo_handle_t *);
 void ifoFree_TT_SRPT(ifo_handle_t *);
 void ifoFree_VTS_PTT_SRPT(ifo_handle_t *);
 void ifoFree_FP_PGC(ifo_handle_t *);
@@ -223,6 +222,7 @@ void ifoFree_VTS_TMAPT(ifo_handle_t *);
  * perform no function -- use ifoFree() only.
  */
 void ifoFree_C_ADT(ifo_handle_t *);
+void ifoFree_PTL_MAIT(ifo_handle_t *);
 void ifoFree_TITLE_C_ADT(ifo_handle_t *);
 void ifoFree_TITLE_VOBU_ADMAP(ifo_handle_t *);
 void ifoFree_TXTDT_MGI(ifo_handle_t *);
diff --git a/src/ifo_read.c b/src/ifo_read.c
index c6a6599..e19bce3 100644
--- a/src/ifo_read.c
+++ b/src/ifo_read.c
@@ -487,6 +487,8 @@ void ifoClose(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
 
+  unsigned int i;
+
   if(ifofile->menu_vobu_admap) {
     free(ifofile->menu_vobu_admap->vobu_start_sectors);
     free(ifofile->menu_vobu_admap);
@@ -516,7 +518,16 @@ void ifoClose(ifo_handle_t *ifofile) {
     free(ifofile->vts_atrt);
   }
 
-  ifoFree_PTL_MAIT(ifofile);
+  if(ifofile->ptl_mait) {
+    if(ifofile->ptl_mait->countries) {
+      for(i = 0; i < ifofile->ptl_mait->nr_of_countries; i++) {
+        free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
+      }
+      free(ifofile->ptl_mait->countries);
+    }
+    free(ifofile->ptl_mait);
+  }
+
   ifoFree_PGCI_UT(ifofile);
   ifoFree_TT_SRPT(ifofile);
   ifoFree_FP_PGC(ifofile);
@@ -1460,19 +1471,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
 }
 
 void ifoFree_PTL_MAIT(ifo_handle_t *ifofile) {
-  if(!ifofile)
-    return;
-
-  if(ifofile->ptl_mait) {
-    unsigned int i;
-
-    for(i = 0; i < ifofile->ptl_mait->nr_of_countries; i++) {
-      free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
-    }
-    free(ifofile->ptl_mait->countries);
-    free(ifofile->ptl_mait);
-    ifofile->ptl_mait = NULL;
-  }
+  return;
 }
 
 int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) {
-- 
2.0.4



More information about the libdvdnav-devel mailing list