From 6ccf33cdbdfda2aea5d51e4d4991881c74d853d1 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Tue, 20 Mar 2007 03:02:26 +0000 Subject: 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. --- dep.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'dep.h') diff --git a/dep.h b/dep.h index f84a83e..adc92c7 100644 --- a/dep.h +++ b/dep.h @@ -36,8 +36,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ struct dep { struct dep *next; - char *name; - char *stem; + const char *name; + const char *stem; struct file *file; unsigned int changed : 8; unsigned int ignore_mtime : 1; @@ -51,7 +51,7 @@ struct dep struct nameseq { struct nameseq *next; - char *name; + const char *name; }; @@ -61,25 +61,20 @@ struct nameseq *parse_file_seq (); #else struct nameseq *parse_file_seq (char **stringp, int stopchar, unsigned int size, int strip); #endif -char *tilde_expand (char *name); +char *tilde_expand (const char *name); #ifndef NO_ARCHIVES struct nameseq *ar_glob (const char *arname, const char *member_pattern, unsigned int size); #endif -#ifndef iAPX286 #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name) -#else -/* Buggy compiler can't hack this. */ -char *dep_name (); -#endif struct dep *alloc_dep (void); void free_dep (struct dep *d); struct dep *copy_dep_chain (const struct dep *d); void free_dep_chain (struct dep *d); void free_ns_chain (struct nameseq *n); -struct dep *read_all_makefiles (char **makefiles); +struct dep *read_all_makefiles (const char **makefiles); int eval_buffer (char *buffer); int update_goal_chain (struct dep *goals); void uniquize_deps (struct dep *); -- cgit v1.2.3