2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
+ * fakemail.c (xmalloc, xreallc): Use standard C prototypes
+ with void *. This avoids warnings about pointer casts.
+
* emacsclient.c (main): Don't use uninitialized var.
(IS_ANY_SEP): Remove; unused.
(get_current_dir_name): Add an extern decl.
/* Like malloc but get fatal error if memory is exhausted. */
-static long *
-xmalloc (int size)
+static void *
+xmalloc (size_t size)
{
- long *result = (long *) malloc (((unsigned) size));
- if (result == ((long *) NULL))
+ void *result = malloc (size);
+ if (! result)
fatal ("virtual memory exhausted");
return result;
}
-static long *
-xrealloc (long int *ptr, int size)
+static void *
+xrealloc (void *ptr, size_t size)
{
- long *result = (long *) realloc (ptr, ((unsigned) size));
- if (result == ((long *) NULL))
+ void *result = realloc (ptr, size);
+ if (! result)
fatal ("virtual memory exhausted");
return result;
}
if (p == end)
{
linebuffer->size *= 2;
- buffer = ((char *) xrealloc ((long *)buffer, linebuffer->size));
+ buffer = (char *) xrealloc (buffer, linebuffer->size);
p = buffer + (p - linebuffer->buffer);
end = buffer + linebuffer->size;
linebuffer->buffer = buffer;