summaryrefslogtreecommitdiff
path: root/src/plugins/logger
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/logger')
-rw-r--r--src/plugins/logger/logger-buffer.c2
-rw-r--r--src/plugins/logger/logger-tail.c11
-rw-r--r--src/plugins/logger/logger.c2
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);