diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-23 23:00:04 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-23 23:00:04 +0100 |
commit | 57323fa71effad75d78b36a45d5457b1bd782963 (patch) | |
tree | 50d7a5bacacebcdf59d5bf38dff84c83bf557d31 /src/plugins/logger | |
parent | 14feea7ab84df3e367bc3732e8ba1470e1a3f5a7 (diff) | |
download | weechat-57323fa71effad75d78b36a45d5457b1bd782963.zip |
Removed sizeof(char) and useless type casts from void* to another pointer type (patch from Leonid Evdokimov)
Diffstat (limited to 'src/plugins/logger')
-rw-r--r-- | src/plugins/logger/logger-buffer.c | 2 | ||||
-rw-r--r-- | src/plugins/logger/logger-tail.c | 11 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c index 13dc5ec39..7db26859c 100644 --- a/src/plugins/logger/logger-buffer.c +++ b/src/plugins/logger/logger-buffer.c @@ -46,7 +46,7 @@ logger_buffer_add (struct t_gui_buffer *buffer, char *log_filename) if (!buffer || !log_filename) return NULL; - new_logger_buffer = (struct t_logger_buffer *)malloc (sizeof (struct t_logger_buffer)); + new_logger_buffer = malloc (sizeof (*new_logger_buffer)); if (new_logger_buffer) { new_logger_buffer->buffer = buffer; diff --git a/src/plugins/logger/logger-tail.c b/src/plugins/logger/logger-tail.c index 4ed48dfd6..52157a289 100644 --- a/src/plugins/logger/logger-tail.c +++ b/src/plugins/logger/logger-tail.c @@ -122,7 +122,7 @@ logger_tail_file (char *filename, int n_lines) pos_eol[0] = '\0'; pos_eol++; } - new_line = (struct t_logger_line *)malloc (sizeof (struct t_logger_line)); + new_line = malloc (sizeof (*new_line)); if (!new_line) { logger_tail_free (ptr_line); @@ -131,8 +131,8 @@ logger_tail_file (char *filename, int n_lines) } if (part_of_line) { - new_line->data = (char *)malloc ((strlen (pos_eol) + - strlen (part_of_line) + 1) * sizeof (char)); + new_line->data = malloc ((strlen (pos_eol) + + strlen (part_of_line) + 1)); if (!new_line->data) { free (part_of_line); @@ -161,8 +161,7 @@ logger_tail_file (char *filename, int n_lines) add string to part_of_line, we'll use that later */ if (part_of_line) { - new_part_of_line = (char *)malloc ((strlen (buf) + - strlen (part_of_line) + 1) * sizeof (char)); + new_part_of_line = malloc (strlen (buf) + strlen (part_of_line) + 1); if (!new_part_of_line) { free (part_of_line); @@ -177,7 +176,7 @@ logger_tail_file (char *filename, int n_lines) } else { - part_of_line = (char *)malloc ((strlen (buf) + 1) * sizeof (char)); + part_of_line = malloc (strlen (buf) + 1); strcpy (part_of_line, buf); } ptr_buf = NULL; diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 7951df9aa..6db3859bb 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -227,7 +227,7 @@ logger_get_filename (struct t_gui_buffer *buffer) if (name2) length += strlen (name2); length += 16; - res = (char *)malloc (length * sizeof (char)); + res = malloc (length); if (res) { strcpy (res, log_path2); |