r37176 - in trunk: gui/interface.c help/help_mp-de.h help/help_mp-en.h
Author: ib Date: Thu Apr 24 15:51:20 2014 New Revision: 37176 Log: Add remove_vf(). (Currently unused, but we will need it soon.) Modified: trunk/gui/interface.c Changes in other areas also in this revision: Modified: trunk/help/help_mp-de.h trunk/help/help_mp-en.h Modified: trunk/gui/interface.c ============================================================================== --- trunk/gui/interface.c Thu Apr 24 15:36:22 2014 (r37175) +++ trunk/gui/interface.c Thu Apr 24 15:51:20 2014 (r37176) @@ -158,6 +158,35 @@ static char **get_vf(const char *vf) return attribs; } +/** + * @brief Remove a video filter. + * + * @param vf video filter to be removed + */ +static void remove_vf(char *vf) +{ + if (vf_settings) { + int i = 0; + + while (vf_settings[i].name) { + if (strcmp(vf_settings[i].name, vf) == 0) { + mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_RemovingVideoFilter, vf); + + free(vf_settings[i].name); + listFree(&vf_settings[i].attribs); + + do + memcpy(&vf_settings[i], &vf_settings[i + 1], sizeof(m_obj_settings_t)); + while (vf_settings[++i].name); + + break; + } + + i++; + } + } +} + /* MPlayer -> GUI */ /**
On Thu, Apr 24, 2014 at 03:51:20PM +0200, ib wrote:
+ do + memcpy(&vf_settings[i], &vf_settings[i + 1], sizeof(m_obj_settings_t)); + while (vf_settings[++i].name);
IMHO there is no good reason to leave out the {} for do-while. They don't need additional lines, and make the code less confusing (because without distinguishing a while and do-while loop is less obvious for example). Another question is if it wouldn't make more sense to first figure out how many to move and then use memmove to copy all at once...
participants (2)
-
ib -
Reimar Döffinger