From a33537b2b98a1acf40bb2bf960e3dc3ba9132fda Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 30 Aug 2011 21:31:46 +0200 Subject: rtsp_client: simplify whitespace elimination Just move a pointer, don't call strlen() in every iteration. --- src/rtsp_client.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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, ":"); -- cgit v1.2.3