Commit c59ea877 by Peter Pentchev

Remove the sizeof(char) weirdness.

Reported by: Jakub Wilk <jwilk@debian.org>
parent 950c0c0e
......@@ -116,13 +116,13 @@ static char *vbprintf (const char *fmt,va_list ap)
if (*fmt == '\0')
{
if ((buf = mem_alloc (sizeof (char))) == NULL)
if ((buf = mem_alloc (1)) == NULL)
return (NULL);
*buf = '\0';
return (buf);
}
if ((buf = mem_alloc (size * sizeof (char))) == NULL)
if ((buf = mem_alloc (size)) == NULL)
return (NULL);
for (;;)
......@@ -141,7 +141,7 @@ static char *vbprintf (const char *fmt,va_list ap)
else /* glibc 2.0 */
size *= 2; /* twice the old size */
if ((ptr = mem_realloc (buf,size * sizeof (char))) == NULL)
if ((ptr = mem_realloc (buf,size)) == NULL)
{
int saved = errno;
mem_free (buf);
......@@ -240,7 +240,7 @@ static char *prefix (struct log_private *priv,const char *filename,int line,cons
len += strlen (buf[i]);
}
if ((buf[4] = mem_alloc ((len + 1) * sizeof (char))) == NULL)
if ((buf[4] = mem_alloc (len + 1)) == NULL)
{
int saved = errno;
for (i = 0; i < n; i++)
......@@ -276,7 +276,7 @@ static int line_append (struct log_private *priv,const char *str)
if (priv->str != NULL)
{
size_t priv_len = strlen(priv->str);
if ((ptr = mem_realloc (priv->str,(len + priv_len) * sizeof (char))) == NULL)
if ((ptr = mem_realloc (priv->str,len + priv_len)) == NULL)
return (-1);
priv->str = ptr;
......@@ -284,7 +284,7 @@ static int line_append (struct log_private *priv,const char *str)
}
else
{
if ((priv->str = mem_alloc (len * sizeof (char))) == NULL)
if ((priv->str = mem_alloc (len)) == NULL)
return (-1);
snprintf(priv->str, len, "%s", str);
}
......@@ -589,7 +589,7 @@ int log_open (const char *logfile,int loglevel,int flags)
int saved;
size_t sz = strlen(logfile) + 1;
if ((log_private.filename = mem_alloc (sz * sizeof (char))) == NULL)
if ((log_private.filename = mem_alloc (sz)) == NULL)
return (-1);
if ((log_private.fd = open (logfile,O_CREAT | O_APPEND | O_WRONLY,S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0)
......@@ -736,7 +736,7 @@ int log_puts_stub (const char *filename,int line,const char *function,int level,
return (0);
size_t sz = strlen(str) + 1;
if ((s = mem_alloc (sizeof (char) * sz)) == NULL)
if ((s = mem_alloc (sz)) == NULL)
return (-1);
snprintf(s, sz, "%s", str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment