diff options
| author | Paul Eggert | 2011-04-16 14:13:07 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-16 14:13:07 -0700 |
| commit | cd52b2441e95f407c0332534ae1997023fe62461 (patch) | |
| tree | 2d55b9c280368fbd55ae6af78cea8eac8919d24a /lib-src | |
| parent | c5443aa547b94725ca257718935692212b5d272d (diff) | |
| download | emacs-cd52b2441e95f407c0332534ae1997023fe62461.tar.gz emacs-cd52b2441e95f407c0332534ae1997023fe62461.zip | |
* 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/ChangeLog | 3 | ||||
| -rw-r--r-- | lib-src/fakemail.c | 18 |
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 @@ | |||
| 1 | 2011-04-16 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-04-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * fakemail.c (xmalloc, xreallc): Use standard C prototypes | ||
| 4 | with void *. This avoids warnings about pointer casts. | ||
| 5 | |||
| 3 | * emacsclient.c (main): Don't use uninitialized var. | 6 | * emacsclient.c (main): Don't use uninitialized var. |
| 4 | (IS_ANY_SEP): Remove; unused. | 7 | (IS_ANY_SEP): Remove; unused. |
| 5 | (get_current_dir_name): Add an extern decl. | 8 | (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) | |||
| 178 | 178 | ||
| 179 | /* Like malloc but get fatal error if memory is exhausted. */ | 179 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 180 | 180 | ||
| 181 | static long * | 181 | static void * |
| 182 | xmalloc (int size) | 182 | xmalloc (size_t size) |
| 183 | { | 183 | { |
| 184 | long *result = (long *) malloc (((unsigned) size)); | 184 | void *result = malloc (size); |
| 185 | if (result == ((long *) NULL)) | 185 | if (! result) |
| 186 | fatal ("virtual memory exhausted"); | 186 | fatal ("virtual memory exhausted"); |
| 187 | return result; | 187 | return result; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | static long * | 190 | static void * |
| 191 | xrealloc (long int *ptr, int size) | 191 | xrealloc (void *ptr, size_t size) |
| 192 | { | 192 | { |
| 193 | long *result = (long *) realloc (ptr, ((unsigned) size)); | 193 | void *result = realloc (ptr, size); |
| 194 | if (result == ((long *) NULL)) | 194 | if (! result) |
| 195 | fatal ("virtual memory exhausted"); | 195 | fatal ("virtual memory exhausted"); |
| 196 | return result; | 196 | return result; |
| 197 | } | 197 | } |
| @@ -221,7 +221,7 @@ readline (struct linebuffer *linebuffer, FILE *stream) | |||
| 221 | if (p == end) | 221 | if (p == end) |
| 222 | { | 222 | { |
| 223 | linebuffer->size *= 2; | 223 | linebuffer->size *= 2; |
| 224 | buffer = ((char *) xrealloc ((long *)buffer, linebuffer->size)); | 224 | buffer = (char *) xrealloc (buffer, linebuffer->size); |
| 225 | p = buffer + (p - linebuffer->buffer); | 225 | p = buffer + (p - linebuffer->buffer); |
| 226 | end = buffer + linebuffer->size; | 226 | end = buffer + linebuffer->size; |
| 227 | linebuffer->buffer = buffer; | 227 | linebuffer->buffer = buffer; |