X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lib-src%2Fsorted-doc.c;h=0b77c45ee4400858329eecd8edb80e5fd0081585;hp=4b82143818eaca932f04385bfaea59b04c06aa0a;hb=716cfba952c1dc0d2cf5c968971f3780ba728a89;hpb=d74da9234cc42e8018b1500105c3892a5c46d5e3 diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index 4b82143..0b77c45 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c @@ -11,19 +11,11 @@ #include #include -#if __STDC__ || defined(STDC_HEADERS) -# include /* for qsort() and malloc() */ -# include -static void *xmalloc (int); -# ifndef CONST -# define CONST const -# endif -#else -extern char *malloc (); -static void *xmalloc (); -# ifndef CONST -# define CONST -# endif +#include /* for qsort() and malloc() */ +#include +static void *xmalloc (size_t); +#ifndef CONST +# define CONST const #endif #define NUL '\0' @@ -31,9 +23,9 @@ static void *xmalloc (); #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 @@ fatal (char *s1, char *s2) /* 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 @@ xmalloc (int size) 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. */