summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-04-16 14:13:07 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-04-16 14:13:07 -0700
commitcd52b2441e95f407c0332534ae1997023fe62461 (patch)
tree2d55b9c280368fbd55ae6af78cea8eac8919d24a /lib-src
parentc5443aa547b94725ca257718935692212b5d272d (diff)
downloademacs-cd52b2441e95f407c0332534ae1997023fe62461.tar.gz
* fakemail.c (xmalloc, xreallc): Use standard C prototypes
with void *. This avoids warnings about pointer casts.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog3
-rw-r--r--lib-src/fakemail.c18
2 files changed, 12 insertions, 9 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 07d51ff14bd..2e3c62d414e 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,5 +1,8 @@
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.
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
index 940d6219425..435512125ff 100644
--- a/lib-src/fakemail.c
+++ b/lib-src/fakemail.c
@@ -178,20 +178,20 @@ fatal (const char *s1)
/* 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;
}
@@ -221,7 +221,7 @@ readline (struct linebuffer *linebuffer, FILE *stream)
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;