Author: matt
Date: 2010-12-19 15:24:06 -0800 (Sun, 19 Dec 2010)
New Revision: 8065
Log:
Added function to free the list that was created with fl_filename_list.
Modified:
branches/branch-1.3/FL/filename.H
branches/branch-1.3/src/filename_list.cxx
Modified: branches/branch-1.3/FL/filename.H
===================================================================
--- branches/branch-1.3/FL/filename.H 2010-12-19 21:39:01 UTC (rev 8064)
+++ branches/branch-1.3/FL/filename.H 2010-12-19 23:24:06 UTC (rev 8065)
@@ -130,6 +130,7 @@
FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
Fl_File_Sort_F *s = fl_numericsort);
+FL_EXPORT void fl_filename_free_list(struct dirent ***l, int n);
/*
* Generic function to open a Uniform Resource Identifier (URI) using a
Modified: branches/branch-1.3/src/filename_list.cxx
===================================================================
--- branches/branch-1.3/src/filename_list.cxx 2010-12-19 21:39:01 UTC (rev
8064)
+++ branches/branch-1.3/src/filename_list.cxx 2010-12-19 23:24:06 UTC (rev
8065)
@@ -131,6 +131,29 @@
return n;
}
+/**
+ \brief Free the list of filenames that is generated by fl_filename_list().
+
+ Free everything that was allocated by a previous call to fl_filename_list().
+ Use the return values as parameters for this function.
+
+ \param[in,out] list table containing the resulting directory listing
+ \param[in] n number of entries in the list
+ */
+void fl_filename_free_list(struct dirent ***list, int n)
+{
+ if (n<0) return;
+
+ int i;
+ for (i = 0; i < n; i ++) {
+ if ((*list)[i])
+ free((*list)[i]);
+ }
+ free(*list);
+ *list = 0;
+}
+
+
//
// End of "$Id$".
//
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit