comparison gui/mplayer/gui_common.c @ 32979:4905f5a87357

Replace some awkward and unnecessary usages of strlen(). 1. A string length of zero or greater than zero can be determined by checking the first byte. 2. Leave it to strdup() to determine the length and to do allocation for a string that is to be copied. 3. If neither the string length nor the index variable is altered in a loop, string[index] (!= 0) is the condition to go with.
author ib
date Thu, 10 Mar 2011 14:20:36 +0000
parents 0dc9d64cd64e
children ff85d256c53e
comparison
equal deleted inserted replaced
32978:b68d209b6f28 32979:4905f5a87357
89 av_strlcpy(tmp, MSGTR_NoMediaOpened, tmplen); 89 av_strlcpy(tmp, MSGTR_NoMediaOpened, tmplen);
90 break; 90 break;
91 } 91 }
92 92
93 if (c) { 93 if (c) {
94 for (i = 0; i < (int)strlen(tmp); i++) { 94 for (i = 0; tmp[i]; i++) {
95 int t = 0; 95 int t = 0;
96 96
97 if (c == 1) 97 if (c == 1)
98 if (tmp[i] >= 'A' && tmp[i] <= 'Z') 98 if (tmp[i] >= 'A' && tmp[i] <= 'Z')
99 t = 32; 99 t = 32;