Tidy up order of includes; make bool variables explicit.
Bool variables are more compact in data and (on x86) on code too:
text data bss dec hex filename
237950 676 19044 257670 3ee86 strace.before
237838 676 19012 257526 3edf6 strace
* defs.h: Group library includes at the top of the file.
Rename dtime to Tflag, debug to debug_flag.
Change debug_flag,Tflag,qflag,not_failing_only,show_fd_path,tracing_paths
variable declarations from int to bool.
* strace.c: Change corresponding definitions. Do the same for static
variables iflag,rflag,print_pid_pfx.
Rename dtime to Tflag, debug to debug_flag.
* syscall.c: Rename dtime to Tflag, debug to debug_flag.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/defs.h b/defs.h
index a565632..6da3edf 100644
--- a/defs.h
+++ b/defs.h
@@ -32,19 +32,35 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-
-#ifdef MIPS
-# include <sgidefs.h>
-#endif
-
-#include <features.h>
-
#ifdef _LARGEFILE64_SOURCE
/* This is the macro everything checks before using foo64 names. */
# ifndef _LFS64_LARGEFILE
# define _LFS64_LARGEFILE 1
# endif
#endif
+#ifdef MIPS
+# include <sgidefs.h>
+#endif
+#include <features.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <time.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stddef.h>
+#endif
+#ifdef HAVE_SIGINFO_T
+# include <signal.h>
+#endif
/* Configuration section */
#ifndef MAX_QUALS
@@ -61,8 +77,8 @@
#ifndef DEFAULT_ACOLUMN
# define DEFAULT_ACOLUMN 40 /* default alignment column for results */
#endif
-
-/* Maximum number of args to a syscall.
+/*
+ * Maximum number of args to a syscall.
*
* Make sure that all entries in all syscallent.h files have nargs <= MAX_ARGS!
* linux/<ARCH>/syscallent.h: all have nargs <= 6.
@@ -70,31 +86,9 @@
#ifndef MAX_ARGS
# define MAX_ARGS 6
#endif
-
+/* default sorting method for call profiling */
#ifndef DEFAULT_SORTBY
-# define DEFAULT_SORTBY "time" /* default sorting method for call profiling */
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <time.h>
-#include <sys/time.h>
-#include <errno.h>
-
-#ifdef HAVE_STDBOOL_H
-# include <stdbool.h>
-#endif
-
-#ifdef STDC_HEADERS
-# include <stddef.h>
-#endif /* STDC_HEADERS */
-
-#ifdef HAVE_SIGINFO_T
-# include <signal.h>
+# define DEFAULT_SORTBY "time"
#endif
#if defined(SPARC) || defined(SPARC64)
@@ -372,7 +366,6 @@
*/
# define TCB_WAITEXECVE 04000
#endif
-#include <sys/syscall.h>
/* qualifier flags */
#define QUAL_TRACE 0001 /* this system call should be traced */
@@ -436,13 +429,19 @@
CFLAG_ONLY_STATS,
CFLAG_BOTH
} cflag_t;
-
-extern int *qual_flags;
-extern int debug, followfork;
-extern unsigned int ptrace_setoptions;
-extern int dtime, xflag, qflag;
extern cflag_t cflag;
-extern int max_strlen;
+extern int *qual_flags;
+extern bool debug_flag;
+extern bool Tflag;
+extern bool qflag;
+extern bool not_failing_only;
+extern bool show_fd_path;
+extern bool tracing_paths;
+extern unsigned int xflag;
+extern unsigned int followfork;
+extern unsigned int ptrace_setoptions;
+extern unsigned int max_strlen;
+
enum bitness_t { BITNESS_CURRENT = 0, BITNESS_32 };
void error_msg(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
@@ -644,7 +643,3 @@
#ifdef IA64
extern long ia32;
#endif
-
-extern int not_failing_only;
-extern int show_fd_path;
-extern int tracing_paths;