diff options
author | Paul Smith <psmith@gnu.org> | 2007-03-20 03:02:26 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2007-03-20 03:02:26 +0000 |
commit | 6ccf33cdbdfda2aea5d51e4d4991881c74d853d1 (patch) | |
tree | ce963770c6d0dc0428a6bce65d96da4b710e2831 /dep.h | |
parent | e4da30858037b431880263676e8f90b1f8412a38 (diff) | |
download | gunmake-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 'dep.h')
-rw-r--r-- | dep.h | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -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 *); |