#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
#ifdef HAVE_UTIME_H
# include <utime.h>
#endif
#endif
/* Needed for run_with_timeout. */
-#undef USE_SIGNAL_TIMEOUT
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
+#include <signal.h>
#ifdef HAVE_SETJMP_H
# include <setjmp.h>
#endif
# endif
#endif
+#undef USE_SIGNAL_TIMEOUT
#ifdef HAVE_SIGNAL
-# ifdef HAVE_SIGSETJMP
-# define USE_SIGNAL_TIMEOUT
-# endif
-# ifdef HAVE_SIGBLOCK
+# if defined(HAVE_SIGSETJMP) || defined(HAVE_SIGBLOCK)
# define USE_SIGNAL_TIMEOUT
# endif
#endif
char *
strdupdelim (const char *beg, const char *end)
{
- char *res = (char *)xmalloc (end - beg + 1);
+ char *res = xmalloc (end - beg + 1);
memcpy (res, beg, end - beg);
res[end - beg] = '\0';
return res;
{
if (*s == ',')
{
- res = (char **)xrealloc (res, (i + 2) * sizeof (char *));
+ res = xrealloc (res, (i + 2) * sizeof (char *));
res[i] = strdupdelim (p, s);
res[++i] = NULL;
++s;
else
++s;
}
- res = (char **)xrealloc (res, (i + 2) * sizeof (char *));
+ res = xrealloc (res, (i + 2) * sizeof (char *));
res[i] = strdupdelim (p, s);
res[i + 1] = NULL;
return res;
if (!cut)
return xstrdup (file);
- result = (char *)xmalloc (cut - base + 1 + strlen (file) + 1);
+ result = xmalloc (cut - base + 1 + strlen (file) + 1);
memcpy (result, base, cut - base);
result[cut - base] = '/';
strcpy (result + (cut - base) + 1, file);
{
int length = 0;
int bufsize = 82;
- char *line = (char *)xmalloc (bufsize);
+ char *line = xmalloc (bufsize);
while (fgets (line + length, bufsize - length, fp))
{
/* Count v2. */
for (j = 0; v2[j]; j++);
/* Reallocate v1. */
- v1 = (char **)xrealloc (v1, (i + j + 1) * sizeof (char **));
+ v1 = xrealloc (v1, (i + j + 1) * sizeof (char **));
memcpy (v1 + i, v2, (j + 1) * sizeof (char *));
xfree (v2);
return v1;
static sigjmp_buf run_with_timeout_env;
-static RETSIGTYPE
+static void
abort_run_with_timeout (int sig)
{
assert (sig == SIGALRM);
static jmp_buf run_with_timeout_env;
-static RETSIGTYPE
+static void
abort_run_with_timeout (int sig)
{
assert (sig == SIGALRM);