diff options
author | James Booth <boothj5@gmail.com> | 2014-04-26 00:36:36 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-04-26 00:36:36 +0100 |
commit | d6e92f62dc907d5da66f477884a4c0c728b84127 (patch) | |
tree | e77d8ad400874baa5edd7dde9ce66b1847fd89e9 /src/common.c | |
parent | ab4ea80a70803d8d6335d8f5a8a4248e6d5423a4 (diff) | |
download | profani-tty-d6e92f62dc907d5da66f477884a4c0c728b84127.tar.gz |
Fixed cppcheck warnings
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/common.c b/src/common.c index 2f811885..314e5440 100644 --- a/src/common.c +++ b/src/common.c @@ -116,7 +116,6 @@ str_replace(const char *string, const char *substr, { char *tok = NULL; char *newstr = NULL; - char *oldstr = NULL; char *head = NULL; if (string == NULL) @@ -131,7 +130,7 @@ str_replace(const char *string, const char *substr, head = newstr; while ( (tok = strstr ( head, substr ))) { - oldstr = newstr; + char *oldstr = newstr; newstr = malloc ( strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) + 1 ); @@ -171,7 +170,6 @@ char * prof_getline(FILE *stream) { char *buf; - size_t buf_size; char *result; char *s = NULL; size_t s_size = 1; @@ -183,7 +181,7 @@ prof_getline(FILE *stream) result = fgets(buf, READ_BUF_SIZE, stream); if (result == NULL) break; - buf_size = strlen(buf); + size_t buf_size = strlen(buf); if (buf[buf_size - 1] == '\n') { buf_size--; buf[buf_size] = '\0'; @@ -416,12 +414,12 @@ cmp_win_num(gconstpointer a, gconstpointer b) int get_next_available_win_num(GList *used) { - int result = 0; used = g_list_sort(used, cmp_win_num); // only console used if (g_list_length(used) == 1) { return 2; } else { + int result = 0; int last_num = 1; GList *curr = used; // skip console |