diff options
author | Max Kellermann <max@duempel.org> | 2011-08-30 21:31:46 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-08-30 21:31:46 +0200 |
commit | a33537b2b98a1acf40bb2bf960e3dc3ba9132fda (patch) | |
tree | d0e777c054b2361ff999ffb3f323769b896cacc5 | |
parent | 81d5c9757c66c1573dbec647834dead13b4bdf85 (diff) | |
download | mpd-a33537b2b98a1acf40bb2bf960e3dc3ba9132fda.tar.gz mpd-a33537b2b98a1acf40bb2bf960e3dc3ba9132fda.tar.xz mpd-a33537b2b98a1acf40bb2bf960e3dc3ba9132fda.zip |
rtsp_client: simplify whitespace elimination
Just move a pointer, don't call strlen() in every iteration.
Diffstat (limited to '')
-rw-r--r-- | src/rtsp_client.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/rtsp_client.c b/src/rtsp_client.c index 1a6304f49..0280581f7 100644 --- a/src/rtsp_client.c +++ b/src/rtsp_client.c @@ -350,7 +350,6 @@ exec_request(struct rtspcl_data *rtspcld, const char *cmd, char *token, *dp; int dsize = 0,rval; struct key_data *cur_kd = *kd; - unsigned int j; int timeout = 5000; // msec unit 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) { timeout = 1000; // once it started, it shouldn't take a long time if (new_kd != NULL && line[0] == ' ') { - for (j = 0; j < strlen(line); j++) if (line[j] != ' ') break; - dsize += strlen(line + j); + const char *j = line; + while (*j == ' ') + ++j; + + dsize += strlen(j); new_kd->data = g_realloc(new_kd->data, dsize); - strcat(new_kd->data, line + j); + strcat(new_kd->data, j); continue; } dp = strstr(line, ":"); |