Mercurial > hg > xemacs-beta
diff lib-src/sorted-doc.c @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 84b14dcb0985 |
children | abe6d1db359e |
line wrap: on
line diff
--- a/lib-src/sorted-doc.c Mon Aug 13 11:32:27 2007 +0200 +++ b/lib-src/sorted-doc.c Mon Aug 13 11:33:38 2007 +0200 @@ -11,19 +11,11 @@ #include <stdio.h> #include <ctype.h> -#if __STDC__ || defined(STDC_HEADERS) -# include <stdlib.h> /* for qsort() and malloc() */ -# include <string.h> -static void *xmalloc (int); -# ifndef CONST -# define CONST const -# endif -#else -extern char *malloc (); -static void *xmalloc (); -# ifndef CONST -# define CONST -# endif +#include <stdlib.h> /* for qsort() and malloc() */ +#include <string.h> +static void *xmalloc (size_t); +#ifndef CONST +# define CONST const #endif #define NUL '\0' @@ -31,9 +23,9 @@ #define DEBUG 0 -typedef struct line LINE; +typedef struct LINE LINE; -struct line +struct LINE { LINE *next; /* ptr to next or NULL */ char *line; /* text of the line */ @@ -72,9 +64,9 @@ /* Like malloc but get fatal error if memory is exhausted. */ static void * -xmalloc (int size) +xmalloc (size_t size) { - char *result = malloc ((unsigned)size); + void *result = malloc (size); if (result == NULL) fatal ("%s", "virtual memory exhausted"); return result; @@ -83,9 +75,9 @@ static char * strsav (char *str) { - char *buf = xmalloc (strlen (str) + 1); - (void) strcpy (buf, str); - return (buf); + char *buf = (char *) xmalloc (strlen (str) + 1); + strcpy (buf, str); + return buf; } /* Comparison function for qsort to call. */