[MPlayer-cvslog] r37977 - in trunk/gui/util: list.c list.h
ib
subversion at mplayerhq.hu
Fri Oct 6 16:00:21 EEST 2017
Author: ib
Date: Fri Oct 6 16:00:21 2017
New Revision: 37977
Log:
Add new listMgr command PLITEM_FREE.
It can be used to destroy a plItem without
having knowledge of its internal structure.
Modified:
trunk/gui/util/list.c
trunk/gui/util/list.h
Modified: trunk/gui/util/list.c
==============================================================================
--- trunk/gui/util/list.c Fri Oct 6 15:51:57 2017 (r37976)
+++ trunk/gui/util/list.c Fri Oct 6 16:00:21 2017 (r37977)
@@ -46,7 +46,7 @@ static urlItem *urlList;
*
* @return pointer to top of list (GET command),
* pointer to current list item (ITEM command) or
- * NULL (DELETE or unknown command)
+ * NULL (PLAYLIST_DELETE, PLITEM_FREE or unknown command)
*
* @note PLAYLIST_ITEM_GET_POS returns the position number as pointer value
* (if @a data is NULL the last position number, i.e. number of items),
@@ -213,10 +213,7 @@ void *listMgr(int cmd, void *data)
while (plList) {
item = plList->next;
- free(plList->path);
- free(plList->name);
- free(plList->title);
- free(plList);
+ listMgr(PLITEM_FREE, plList);
plList = item;
}
@@ -224,6 +221,17 @@ void *listMgr(int cmd, void *data)
plCurrent = NULL;
return NULL;
+ case PLITEM_FREE:
+
+ if (pdat) {
+ free(pdat->path);
+ free(pdat->name);
+ free(pdat->title);
+ free(pdat);
+ }
+
+ return NULL;
+
/* URL list */
case URLLIST_GET:
Modified: trunk/gui/util/list.h
==============================================================================
--- trunk/gui/util/list.h Fri Oct 6 15:51:57 2017 (r37976)
+++ trunk/gui/util/list.h Fri Oct 6 16:00:21 2017 (r37977)
@@ -33,6 +33,7 @@ enum {
PLAYLIST_ITEM_GET_LAST,
PLAYLIST_ITEM_DEL_CURR,
PLAYLIST_DELETE,
+ PLITEM_FREE,
URLLIST_GET,
URLLIST_ITEM_ADD,
URLLIST_DELETE
More information about the MPlayer-cvslog
mailing list