summaryrefslogtreecommitdiff
path: root/filedef.h
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2007-03-20 03:02:26 +0000
committerPaul Smith <psmith@gnu.org>2007-03-20 03:02:26 +0000
commit6ccf33cdbdfda2aea5d51e4d4991881c74d853d1 (patch)
treece963770c6d0dc0428a6bce65d96da4b710e2831 /filedef.h
parente4da30858037b431880263676e8f90b1f8412a38 (diff)
downloadgunmake-6ccf33cdbdfda2aea5d51e4d4991881c74d853d1.tar.gz
This is a major update, which switches virtually every allocated-but-not-freed
string into the strcache. As a side-effect, many more structure members and function arguments can/should be declared const. As mentioned in the changelog, unfortunately measurement shows that this change does not yet reduce memory. The problem is with secondary expansion: because of this we store all the prerequisites in the string cache twice. First we store the prerequisite string after initial expansion but before secondary expansion, then we store each individual file after secondary expansion and expand_deps(). I plan to change expand_deps() to be callable in either context (eval or snap_deps) then have non-second-expansion targets call expand_deps() during eval, so that we only need to store that dependency list once.
Diffstat (limited to 'filedef.h')
-rw-r--r--filedef.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/filedef.h b/filedef.h
index b5469a2..0af72f5 100644
--- a/filedef.h
+++ b/filedef.h
@@ -25,14 +25,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */
struct file
{
- char *name;
- char *hname; /* Hashed filename */
- char *vpath; /* VPATH/vpath pathname */
+ const char *name;
+ const char *hname; /* Hashed filename */
+ const char *vpath; /* VPATH/vpath pathname */
struct dep *deps; /* all dependencies, including duplicates */
struct commands *cmds; /* Commands to execute for this target. */
int command_flags; /* Flags OR'd in for cmds; see commands.h. */
- char *stem; /* Implicit stem, if an implicit
- rule has been used */
+ const char *stem; /* Implicit stem, if an implicit
+ rule has been used */
struct dep *also_make; /* Targets that are made by making this. */
FILE_TIMESTAMP last_mtime; /* File's modtime, if already known. */
FILE_TIMESTAMP mtime_before_update; /* File's modtime before any updating
@@ -101,13 +101,13 @@ extern struct file *default_goal_file, *suffix_file, *default_file;
extern char **default_goal_name;
-struct file *lookup_file (char *name);
-struct file *enter_file (char *name);
+struct file *lookup_file (const char *name);
+struct file *enter_file (const char *name);
struct dep *parse_prereqs (char *prereqs);
void remove_intermediates (int sig);
void snap_deps (void);
-void rename_file (struct file *file, char *name);
-void rehash_file (struct file *file, char *name);
+void rename_file (struct file *file, const char *name);
+void rehash_file (struct file *file, const char *name);
void set_command_state (struct file *file, enum cmd_state state);
void notice_finished_file (struct file *file);
void init_hash_files (void);