summaryrefslogtreecommitdiff
path: root/makeint.h
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-06-22 00:22:08 -0400
committerPaul Smith <psmith@gnu.org>2013-06-22 00:22:08 -0400
commitcc85b927cdc1a4dad3217842215903a45044fc43 (patch)
tree74ae34c9306f5dde33e258c4181215ee04d4203f /makeint.h
parentbee4d93a591f7f729717f6079f7d62ef555d9887 (diff)
downloadgunmake-cc85b927cdc1a4dad3217842215903a45044fc43.tar.gz
Create a character map to use for locating stop-points in strings.
In various places we were passing flags and characters to compare, then using complex conditionals to see where to stop in string searches. Performance numbers reveal that we were spending as much as 23% of our processing time in these functions, most of it in the comparison lines. Instead create a character map and use a single bitwise comparison to determine if this is any one of the stop characters.
Diffstat (limited to 'makeint.h')
-rw-r--r--makeint.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/makeint.h b/makeint.h
index a145970..f119680 100644
--- a/makeint.h
+++ b/makeint.h
@@ -364,7 +364,6 @@ char *strsignal (int signum);
void sync_Path_environment (void);
int w32_kill (pid_t pid, int sig);
-char *end_of_token_w32 (const char *s, char stopchar);
int find_and_set_default_shell (const char *token);
/* indicates whether or not we have Bourne shell */
@@ -382,6 +381,34 @@ extern int unixy_shell;
#define WIN32_LEAN_AND_MEAN
#endif /* WINDOWS32 */
+#define ANY_SET(_v,_m) (((_v)&(_m)) != 0)
+#define NONE_SET(_v,_m) (! ANY_SET ((_v),(_m)))
+
+#define MAP_NUL 0x0001
+#define MAP_BLANK 0x0002
+#define MAP_SPACE 0x0004
+#define MAP_COMMENT 0x0008
+#define MAP_SEMI 0x0010
+#define MAP_EQUALS 0x0020
+#define MAP_COLON 0x0040
+#define MAP_PERCENT 0x0080
+#define MAP_PIPE 0x0100
+#define MAP_DOT 0x0200
+#define MAP_COMMA 0x0400
+
+/* This means not only a '$', but skip the variable reference. */
+#define MAP_VARIABLE 0x4000
+/* The set of characters which are path separators is OS-specific. */
+#define MAP_PATHSEP 0x8000
+
+#ifdef VMS
+# define MAP_VMSCOMMA MAP_COMMA
+#else
+# define MAP_VMSCOMMA 0x0000
+#endif
+
+#define STOP_SET(_v,_m) ANY_SET (stopchar_map[(int)(_v)],(_m))
+
#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
# define SET_STACK_SIZE
#endif
@@ -555,6 +582,8 @@ extern const gmk_floc **expanding_var;
extern char **environ;
+extern unsigned short stopchar_map[];
+
extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
extern int print_data_base_flag, question_flag, touch_flag, always_make_flag;
extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;