changeset 111558:a673d202fe46

Convert definitions to standard C. * src/strftime.c (LOCALE_PARAM_DECL): Update for standard C. (LOCALE_PARAM, LOCALE_PARAM_PROTO): Remove, unused. (memcpy_lowcase, so_week_days, extra_args_spec, emacs_strftimeu): Convert definitions to standard C. * src/regex.c: Do not include <stdlib.h>, config.h does it. Include unistd.h. (xrealloc, init_syntax_once, re_match, regcomp, regexec) (regerror, regfree): Convert definitions to standard C. * src/mktime.c (my_mktime_localtime_r, ydhms_tm_diff, ranged_convert) (__mktime_internal): Convert definitions to standard C.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 15 Nov 2010 22:44:51 -0800
parents 8bb6a226933b
children 7ac0fe73f41d
files src/ChangeLog src/mktime.c src/regex.c src/strftime.c
diffstat 4 files changed, 41 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Nov 16 00:04:25 2010 +0000
+++ b/src/ChangeLog	Mon Nov 15 22:44:51 2010 -0800
@@ -1,3 +1,16 @@
+2010-11-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* strftime.c (LOCALE_PARAM_DECL): Update for standard C.
+	(LOCALE_PARAM, LOCALE_PARAM_PROTO): Remove, unused.
+	(memcpy_lowcase, so_week_days, extra_args_spec, emacs_strftimeu):
+	Convert definitions to standard C.
+	* regex.c: Do not include <stdlib.h>, config.h does it.
+	Include unistd.h.
+	(xrealloc, init_syntax_once, re_match, regcomp, regexec)
+	(regerror, regfree): Convert definitions to standard C.
+	* mktime.c (my_mktime_localtime_r, ydhms_tm_diff, ranged_convert)
+	(__mktime_internal): Convert definitions to standard C.
+
 2010-11-15  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* w32proc.c:
--- a/src/mktime.c	Tue Nov 16 00:04:25 2010 +0000
+++ b/src/mktime.c	Mon Nov 15 22:44:51 2010 -0800
@@ -110,9 +110,7 @@
    localtime to localtime_r, since many localtime_r implementations
    are buggy.  */
 static struct tm *
-my_mktime_localtime_r (t, tp)
-     const time_t *t;
-     struct tm *tp;
+my_mktime_localtime_r (const time_t *t,  struct tm *tp)
 {
   struct tm *l = localtime (t);
   if (! l)
@@ -130,9 +128,7 @@
    If TP is null, return a nonzero value.
    If overflow occurs, yield the low order bits of the correct answer.  */
 static time_t
-ydhms_tm_diff (year, yday, hour, min, sec, tp)
-     int year, yday, hour, min, sec;
-     const struct tm *tp;
+ydhms_tm_diff (int year, int yday, int hour, int min, int sec, const struct tm *tp)
 {
   if (!tp)
     return 1;
@@ -163,14 +159,8 @@
    If *T is out of range for conversion, adjust it so that
    it is the nearest in-range value and then convert that.  */
 static struct tm *
-ranged_convert (convert, t, tp)
-#ifdef PROTOTYPES
-     struct tm *(*convert) (const time_t *, struct tm *);
-#else
-     struct tm *(*convert)();
-#endif
-     time_t *t;
-     struct tm *tp;
+ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
+		time_t *t, struct tm *tp)
 {
   struct tm *r;
 
@@ -217,14 +207,8 @@
    compared to what the result would be for UTC without leap seconds.
    If *OFFSET's guess is correct, only one CONVERT call is needed.  */
 time_t
-__mktime_internal (tp, convert, offset)
-     struct tm *tp;
-#ifdef PROTOTYPES
-     struct tm *(*convert) (const time_t *, struct tm *);
-#else
-     struct tm *(*convert)();
-#endif
-     time_t *offset;
+__mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *),
+		   time_t *offset)
 {
   time_t t, dt, t0, t1, t2;
   struct tm tm;
@@ -558,5 +542,3 @@
 End:
 */
 
-/* arch-tag: 9456752f-7ddd-47cb-8286-fa807b1355ae
-   (do not change this comment) */
--- a/src/regex.c	Tue Nov 16 00:04:25 2010 +0000
+++ b/src/regex.c	Mon Nov 15 22:44:51 2010 -0800
@@ -196,18 +196,14 @@
    even if config.h says that we can.  */
 # undef REL_ALLOC
 
-# if defined STDC_HEADERS || defined _LIBC
-#  include <stdlib.h>
-# else
-char *malloc ();
-char *realloc ();
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
 # endif
 
 /* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
 
 void *
-xmalloc (size)
-     size_t size;
+xmalloc (size_t size)
 {
   register void *val;
   val = (void *) malloc (size);
@@ -220,9 +216,7 @@
 }
 
 void *
-xrealloc (block, size)
-     void *block;
-     size_t size;
+xrealloc (void *block, size_t size)
 {
   register void *val;
   /* We must call malloc explicitly when BLOCK is 0, since some
@@ -435,7 +429,7 @@
 static char re_syntax_table[CHAR_SET_SIZE];
 
 static void
-init_syntax_once ()
+init_syntax_once (void)
 {
    register int c;
    static int done = 0;
@@ -4978,11 +4972,8 @@
 /* re_match is like re_match_2 except it takes only a single string.  */
 
 int
-re_match (bufp, string, size, pos, regs)
-     struct re_pattern_buffer *bufp;
-     const char *string;
-     int size, pos;
-     struct re_registers *regs;
+re_match (struct re_pattern_buffer *bufp, const char *string,
+	  int size, int pos, struct re_registers *regs)
 {
   int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size,
 				    pos, regs, size);
@@ -6534,10 +6525,8 @@
    the return codes and their meanings.)  */
 
 int
-regcomp (preg, pattern, cflags)
-    regex_t *__restrict preg;
-    const char *__restrict pattern;
-    int cflags;
+regcomp (regex_t *__restrict preg, const char *__restrict pattern,
+	 int cflags)
 {
   reg_errcode_t ret;
   reg_syntax_t syntax
@@ -6619,12 +6608,8 @@
    We return 0 if we find a match and REG_NOMATCH if not.  */
 
 int
-regexec (preg, string, nmatch, pmatch, eflags)
-    const regex_t *__restrict preg;
-    const char *__restrict string;
-    size_t nmatch;
-    regmatch_t pmatch[__restrict_arr];
-    int eflags;
+regexec (const regex_t *__restrict preg, const char *__restrict string,
+	 size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags)
 {
   int ret;
   struct re_registers regs;
@@ -6696,11 +6681,7 @@
    error with msvc8 compiler.  */
 
 size_t
-regerror (err_code, preg, errbuf, errbuf_size)
-    int err_code;
-    const regex_t *preg;
-    char *errbuf;
-    size_t errbuf_size;
+regerror (int err_code, const regex_t *preg, char *errbuf, size_t errbuf_size)
 {
   const char *msg;
   size_t msg_size;
@@ -6736,8 +6717,7 @@
 /* Free dynamically allocated space used by PREG.  */
 
 void
-regfree (preg)
-    regex_t *preg;
+regfree (regex_t *preg)
 {
   free (preg->buffer);
   preg->buffer = NULL;
@@ -6756,5 +6736,3 @@
 
 #endif /* not emacs  */
 
-/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2
-   (do not change this comment) */
--- a/src/strftime.c	Tue Nov 16 00:04:25 2010 +0000
+++ b/src/strftime.c	Mon Nov 15 22:44:51 2010 -0800
@@ -318,14 +318,10 @@
 # undef _NL_CURRENT
 # define _NL_CURRENT(category, item) \
   (current->values[_NL_ITEM_INDEX (item)].string)
-# define LOCALE_PARAM , loc
 # define LOCALE_ARG , loc
-# define LOCALE_PARAM_DECL  __locale_t loc;
-# define LOCALE_PARAM_PROTO , __locale_t loc
+# define LOCALE_PARAM_DECL , __locale_t loc
 # define HELPER_LOCALE_ARG  , current
 #else
-# define LOCALE_PARAM
-# define LOCALE_PARAM_PROTO
 # define LOCALE_ARG
 # define LOCALE_PARAM_DECL
 # ifdef _LIBC
@@ -363,30 +359,16 @@
    more reliable way to accept other sets of digits.  */
 #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
 
-static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src,
-                               size_t len LOCALE_PARAM_PROTO);
-
 static CHAR_T *
-memcpy_lowcase (dest, src, len LOCALE_PARAM)
-     CHAR_T *dest;
-     const CHAR_T *src;
-     size_t len;
-     LOCALE_PARAM_DECL
+memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL)
 {
   while (len-- > 0)
     dest[len] = TOLOWER ((UCHAR_T) src[len], loc);
   return dest;
 }
 
-static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src,
-                               size_t len LOCALE_PARAM_PROTO);
-
 static CHAR_T *
-memcpy_uppcase (dest, src, len LOCALE_PARAM)
-     CHAR_T *dest;
-     const CHAR_T *src;
-     size_t len;
-     LOCALE_PARAM_DECL
+memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL)
 {
   while (len-- > 0)
     dest[len] = TOUPPER ((UCHAR_T) src[len], loc);
@@ -437,9 +419,7 @@
 __inline__
 #endif
 static int
-iso_week_days (yday, wday)
-     int yday;
-     int wday;
+iso_week_days (int yday, int wday)
 {
   /* Add enough to the first operand of % to make it nonnegative.  */
   int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
@@ -470,7 +450,7 @@
 
 #ifdef my_strftime
 # define extra_args , ut, ns
-# define extra_args_spec int ut; int ns;
+# define extra_args_spec , int ut, int ns
 # define extra_args_spec_iso , int ut, int ns
 #else
 # ifdef COMPILE_WIDE
@@ -517,13 +497,8 @@
    anywhere, so to determine how many characters would be
    written, use NULL for S and (size_t) UINT_MAX for MAXSIZE.  */
 size_t
-my_strftime (s, maxsize, format, tp extra_args LOCALE_PARAM)
-      CHAR_T *s;
-      size_t maxsize;
-      const CHAR_T *format;
-      const struct tm *tp;
-      extra_args_spec
-      LOCALE_PARAM_DECL
+my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
+	     const struct tm *tp extra_args_spec LOCALE_PARAM_DECL)
 {
 #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
   struct locale_data *const current = loc->__locales[LC_TIME];
@@ -1474,16 +1449,10 @@
 /* For Emacs we have a separate interface which corresponds to the normal
    strftime function plus the ut argument, but without the ns argument.  */
 size_t
-emacs_strftimeu (s, maxsize, format, tp, ut)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      const struct tm *tp;
-      int ut;
+emacs_strftimeu (char *s, size_t maxsize, const char *format,
+		 const struct tm *tp, int ut)
 {
   return my_strftime (s, maxsize, format, tp, ut, 0);
 }
 #endif
 
-/* arch-tag: 662bc9c4-f8e2-41b6-bf96-b8346d0ce0d8
-   (do not change this comment) */