comparison gui/mplayer/play.c @ 32893:c873777e957d

Get rid of needless listItems variable and pointer. The tmpList structure variable was only used to check whether a skin can be read without error. After the check tmpList was erased and the same skin read once again into another structure - the appropriate target structure. Now error checking is done with skin reading into the target structure. The separate skinAppMPlayer pointer was needless, because a skin will only be read into the one global listItems structure appMPlayer, so that its address can be used right away. Freeing the listItems was done twice before and is now performed at a single place, where the fonts are freed now as well - in skinRead() right before skin reading starts. As a result there is now only one listItems variable - the global appMPlayer; memory is saved, passing around global variables and pointless double actions are avoided.
author ib
date Sun, 27 Feb 2011 17:41:05 +0000
parents bd3ea059fe2d
children f01aafc5a961
comparison
equal deleted inserted replaced
32892:b5f21d533644 32893:c873777e957d
192 192
193 rel_seek_secs = 0.01 * s; // 0.0..100.0 193 rel_seek_secs = 0.01 * s; // 0.0..100.0
194 abs_seek_pos = 3; 194 abs_seek_pos = 3;
195 } 195 }
196 196
197 listItems tmpList;
198
199 void ChangeSkin(char *name) 197 void ChangeSkin(char *name)
200 { 198 {
201 int prev, bprev, ret; 199 int prev, bprev;
202 200
203 prev = appMPlayer.menuIsPresent; 201 prev = appMPlayer.menuIsPresent;
204 bprev = appMPlayer.barIsPresent; 202 bprev = appMPlayer.barIsPresent;
205 203
206 mainVisible = 0; 204 mainVisible = 0;
207 205
208 appInitStruct(&tmpList); 206 if (skinRead(name) != 0) {
209 skinAppMPlayer = &tmpList; 207 if (skinRead(skinName) != 0) {
210 fntFreeFont();
211 ret = skinRead(name);
212
213 appInitStruct(&tmpList);
214 skinAppMPlayer = &appMPlayer;
215 appInitStruct(&appMPlayer);
216
217 if (ret)
218 name = skinName;
219
220 if (skinRead(name)) {
221 mainVisible = 1; 208 mainVisible = 1;
222 return; 209 return;
210 }
223 } 211 }
224 212
225 // reload menu window 213 // reload menu window
226 214
227 if (prev && appMPlayer.menuIsPresent) { 215 if (prev && appMPlayer.menuIsPresent) {