From: Diego P. <dg...@us...> - 2008-03-11 23:38:52
|
Update of /cvsroot/xine/xine-ui/src/xitk In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv11925/src/xitk Modified Files: actions.c Log Message: Don't duplicate the token for no good reason, just get the lenght of the MRL scheme. Also avoid calling mediamark_get_current_mrl() twice. Index: actions.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/actions.c,v retrieving revision 1.287 retrieving revision 1.288 diff -u -r1.287 -r1.288 --- actions.c 16 Jan 2008 15:04:17 -0000 1.287 +++ actions.c 11 Mar 2008 23:38:56 -0000 1.288 @@ -837,26 +837,22 @@ mediamark_t **mmk = NULL; char *tok = NULL; char *mrl; - int len; + size_t tok_len = 0; int new_num = 0; + + const char *const cur_mrl = mediamark_get_current_mrl(); /* * If it's an mrl (____://) remove all of them in playlist */ - mrl = strstr((mediamark_get_current_mrl()), ":/"); - if(mrl) { - char *cur_mrl = (char *)mediamark_get_current_mrl(); - - len = (mrl - cur_mrl) + 3; - tok = (char *) alloca(len); - strlcpy(tok, cur_mrl, len); - } + if ( (mrl = strstr((cur_mrl), ":/")) ) + tok_len = (mrl - cur_mrl) + 2; - if(tok != NULL) { + if(tok_len != 0) { /* * Store all of not maching entries */ for(i = 0; i < gGui->playlist.num; i++) { - if(strncasecmp(gGui->playlist.mmk[i]->mrl, tok, strlen(tok))) { + if(strncasecmp(gGui->playlist.mmk[i]->mrl, cur_mrl, tok_len)) { mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (new_num + 2)); |