rtsp_client: simplify whitespace elimination
Just move a pointer, don't call strlen() in every iteration.
This commit is contained in:
parent
81d5c9757c
commit
a33537b2b9
@ -350,7 +350,6 @@ exec_request(struct rtspcl_data *rtspcld, const char *cmd,
|
|||||||
char *token, *dp;
|
char *token, *dp;
|
||||||
int dsize = 0,rval;
|
int dsize = 0,rval;
|
||||||
struct key_data *cur_kd = *kd;
|
struct key_data *cur_kd = *kd;
|
||||||
unsigned int j;
|
|
||||||
int timeout = 5000; // msec unit
|
int timeout = 5000; // msec unit
|
||||||
|
|
||||||
fd_set rdfds;
|
fd_set rdfds;
|
||||||
@ -441,10 +440,13 @@ exec_request(struct rtspcl_data *rtspcld, const char *cmd,
|
|||||||
while (read_line(rtspcld->fd, line, sizeof(line), timeout, 0) > 0) {
|
while (read_line(rtspcld->fd, line, sizeof(line), timeout, 0) > 0) {
|
||||||
timeout = 1000; // once it started, it shouldn't take a long time
|
timeout = 1000; // once it started, it shouldn't take a long time
|
||||||
if (new_kd != NULL && line[0] == ' ') {
|
if (new_kd != NULL && line[0] == ' ') {
|
||||||
for (j = 0; j < strlen(line); j++) if (line[j] != ' ') break;
|
const char *j = line;
|
||||||
dsize += strlen(line + j);
|
while (*j == ' ')
|
||||||
|
++j;
|
||||||
|
|
||||||
|
dsize += strlen(j);
|
||||||
new_kd->data = g_realloc(new_kd->data, dsize);
|
new_kd->data = g_realloc(new_kd->data, dsize);
|
||||||
strcat(new_kd->data, line + j);
|
strcat(new_kd->data, j);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dp = strstr(line, ":");
|
dp = strstr(line, ":");
|
||||||
|
Loading…
Reference in New Issue
Block a user