summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2010-11-15 22:44:51 -0800
committerDan Nicolaescu <dann@ics.uci.edu>2010-11-15 22:44:51 -0800
commitd2762c86419d6d55bf59fd62ea1c9fa3525411c0 (patch)
treee1ba41021fe7ba2f29a79a51f23785f352547dc2
parent0073e0313a029f5bba231a147f0d4f1bb029dd43 (diff)
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.
-rw-r--r--src/ChangeLog13
-rw-r--r--src/mktime.c30
-rw-r--r--src/regex.c48
-rw-r--r--src/strftime.c49
4 files changed, 41 insertions, 99 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index af5bbf9e8f..ca673be007 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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:
diff --git a/src/mktime.c b/src/mktime.c
index 3570cecd45..ede151981f 100644
--- a/src/mktime.c
+++ b/src/mktime.c
@@ -110,9 +110,7 @@ const unsigned short int __mon_yday[2][13] =
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 @@ my_mktime_localtime_r (t, tp)
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 @@ ydhms_tm_diff (year, yday, hour, min, sec, tp)
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 @@ ranged_convert (convert, t, tp)
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 @@ compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mkti
End:
*/
-/* arch-tag: 9456752f-7ddd-47cb-8286-fa807b1355ae
- (do not change this comment) */
diff --git a/src/regex.c b/src/regex.c
index 17158552a9..31f188efa9 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -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 @@ xmalloc (size)
}
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 @@ extern char *re_syntax_table;
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 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r
/* 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 @@ re_exec (s)
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 @@ WEAK_ALIAS (__regcomp, regcomp)
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 @@ WEAK_ALIAS (__regexec, regexec)
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 @@ WEAK_ALIAS (__regerror, regerror)
/* 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 @@ WEAK_ALIAS (__regfree, regfree)
#endif /* not emacs */
-/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2
- (do not change this comment) */
diff --git a/src/strftime.c b/src/strftime.c
index a761742779..56c2a2c0fb 100644
--- a/src/strftime.c
+++ b/src/strftime.c
@@ -318,14 +318,10 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
# 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 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
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 @@ static int iso_week_days (int, int);
__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 @@ static CHAR_T const month_name[][10] =
#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 @@ static CHAR_T const month_name[][10] =
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 @@ libc_hidden_def (my_strftime)
/* 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) */