Hartmut Brandt
1b0d28102e
Style: make indentation 8 characters.
2005-03-23 16:14:41 +00:00
Hartmut Brandt
fb1dac11b4
Make paths an explicite datatype instead of using the generic Lst.
...
A Path is now a TAILQ of PathElements each of which just points to
a reference counted directory. Rename all functions dealing with Paths
from the Dir_ prefix to a Path_ prefix.
2005-03-23 12:56:15 +00:00
Hartmut Brandt
76a6d2363f
Style: <space><tab> -> <tab>
2005-03-22 12:59:02 +00:00
Hartmut Brandt
cbb7c3931c
Rename struct Path to struct Dir and move it into the C-file. It
...
is not used outside.
2005-03-22 12:54:46 +00:00
Hartmut Brandt
35167ece76
Remove debugging code that crept in in the last commit.
2005-03-22 12:52:00 +00:00
Hartmut Brandt
ad6ba6872a
Remove Lst_Find() and Lst_FindFrom() now that they aren't needed anymore.
2005-03-22 12:40:24 +00:00
Hartmut Brandt
e4a90d00b4
Remove the last two instances of Lst_Find() calls.
2005-03-22 12:38:55 +00:00
Hartmut Brandt
144b68a7ef
Use VarParse() inside var.c instead of Var_Parse().
...
Patch: 7.163
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:20:08 +00:00
Hartmut Brandt
6fd71d7a66
Unify callers to Var_Parse() with regard to variable names.
...
Patch: 7.162
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:18:15 +00:00
Hartmut Brandt
a4c193bbe2
Make some callers of VarFind using the same code structure.
...
Patch: 7.161
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:16:09 +00:00
Hartmut Brandt
29b59e2865
De-lispify some if()-expressions by removing extra parantheses.
...
Patch: 7.160
Requested by: harti
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:12:16 +00:00
Hartmut Brandt
b6c44471ba
Return a Buf object from VarGetPattern() instead of a char * and a size_t.
...
Store a Buf object in struct VarPattern instead of a char * and a length.
Patch: 7.158
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:09:43 +00:00
Hartmut Brandt
ce873d22d5
Use the struct VarPattern's lhs field instead of using an extra variable
...
to store the left expression of a C modificator.
Patch: 7.157
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:06:34 +00:00
Hartmut Brandt
6edf648505
Merge struct VarREPattern into struct VarPattern. This will help sorting
...
out common code.
Patch: 7.156
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:03:42 +00:00
Hartmut Brandt
b31a79d77e
Sort prototypes.
...
Patch: 7.155
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:01:04 +00:00
Hartmut Brandt
d344c54aba
Fix indentation.
...
Patch: 7.154 (partly)
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:00:02 +00:00
Hartmut Brandt
5af70720f4
Delete an extra empty line.
...
Patch: 7.153
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:57:18 +00:00
Hartmut Brandt
1ff3feb03d
An automatic variable in a local scope is (conceptionally) destroyed with
...
the closing brace so it is unwise to keep a pointer to it. Make
the variable static to fix this.
Patch: 7.152
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:56:22 +00:00
Hartmut Brandt
4896df6314
Simplify buffer access by using Buf_Data() and Buf_Peel() where
...
appropriate.
Patch: 7.147-7.151
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:50:40 +00:00
Hartmut Brandt
9668c011e9
Two new functions: Buf_Data() returns a reference to the data in
...
the buffer and Buf_AppendBuf() appends a copy of one buffer to another
buffer.
Patch: 7.146,7.147
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:42:51 +00:00
Hartmut Brandt
cffe7fcdef
Remove a temporary variable. Rename pattern to patt to be consistent.
...
Remove unreachable code for VAR_NOSUBST - it was never set.
Replace redundant code with calls to VarGetPattern().
Patch: 7.143-7.145
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:38:46 +00:00
Hartmut Brandt
1610cab61d
Remove unneeded temporary variables in modifier_S() and modifier_C().
...
Change the parsing of the C modifier flags so that specifying both
'1' and 'g' gives an error.
Patch: 7.141,7.142
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:40:27 +00:00
Hartmut Brandt
090051a931
Remove comment about Var_Parse assuming that the first character
...
is always a '$'. This is not always correct, for example for
conditionals: .if defined(foobar).
Clean up some comments.
Move common code out of if-statements.
Patch: 7.140
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:32:41 +00:00
Hartmut Brandt
f244a9fb0a
Split out SysV variable substitution into its own function.
...
Patch: 7.139
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:27:53 +00:00
Hartmut Brandt
a33399ac68
Rename freePtr to freeResult to make it more obvious about what
...
pointer we're talking.
Patch: 7.138
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:19:23 +00:00
Hartmut Brandt
6cb006aff1
Move some code from ParseModifier() into the calling function to
...
simplify things. Correct a number comments.
Patch: 7.137
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:17:44 +00:00
Hartmut Brandt
61cc000336
Cleanup the VAR_JUNK handling.
...
Patch: 7.136
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:15:06 +00:00
Hartmut Brandt
8f712e5034
Don't pass 'consumed' through all the parsing routines where it can be computed
...
by the caller. Don't pass 'endc' - it can be computed from 'startc'.
Remove unneccessary temporary variables. Remove constant if-expressions
and remove code before call Fatal() - there is no point to cleanup before
aborting.
Patch: 7.134,7.135
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:07:14 +00:00
Hartmut Brandt
b072d12283
Change one occurence of 'delim' to the correct type. Delete another
...
occurence which actually holds always the same constant value.
Shorten the name pattern to patt.
Patch: 7.133
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 11:54:46 +00:00
Hartmut Brandt
13591063f0
Replace calls to Lst_Find with either appropriate LST_FOREACH macros
...
plus predicate inlining or a special purpose function with takes
and returns the correct types.
2005-03-21 11:44:57 +00:00
Hartmut Brandt
0906b0904f
Reduce number of parameters passed between the parsing routines
...
by putting them into struct VarParser or computing them (consumed).
Change the loop termination condition in VarParseLong from endc to \0.
Patch: 7.128-7.132
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 11:43:02 +00:00
Hartmut Brandt
73c5a04dfa
Reduce the number of explicit parameters passed to VarParse()
...
by passing them through struct VarParser.
Patch: 7.127
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-21 07:40:33 +00:00
Hartmut Brandt
cedc4e46c2
Cleanup handling of colons in variable substitutions.
...
Patch: 7.126
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-18 16:52:46 +00:00
Hartmut Brandt
af0b17b173
Unfold parsing of single letter modifiers from multi-letter ones.
...
Patch: 7.125
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:51:04 +00:00
Hartmut Brandt
2ae8b5b5f6
Style: fix indentation and <space><tab>.
...
Patch: 7.124
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:44:23 +00:00
Hartmut Brandt
e524dd1162
Split out the 'S' modifier into its own function.
...
Patch: 7.122,7.123
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:37:31 +00:00
Hartmut Brandt
1753011e3f
Convert Var_Parse to a wrapper function.
...
Reduce the number of arguments passed between these functions by
creating a special-purpose struct.
Patch: 7.120,7.121
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:34:07 +00:00
Hartmut Brandt
6ea1a0dc21
Replace Lst_Find calls with LST_FOREACH loops. This helps in
...
constification und simplifies the code because the one-liner
predicates can be inlined into the code.
2005-03-18 15:25:23 +00:00
Hartmut Brandt
2559e71404
Replace a bogus use of Lst_Find with explicite LST_FOREACH calls
...
and remove the unneeded second argument to ReadMakefile.
2005-03-18 15:23:49 +00:00
Hartmut Brandt
7ea59d002e
Fix a bug in matching suffixes. Under certain circumstances the code
...
would access memory before the beginning of the string to match (the
suffix match starts at the end of both the string and the suffix and
proceedes to the begin until either the start of the suffix is hit
or the character does not match). This could lead to a memcpy copying
into random memory. Fix this by checking the length of the string to
match too and replacing the Lst_Find calls with LST_FOREACH loops
(last part by me).
Submitted by: Matt Dillon <dillon@apollo.backplane.com> (in principle)
2005-03-18 15:16:09 +00:00
Hartmut Brandt
0ce37001aa
Now that there are no users of Lst_ForEach and Lst_ForEachFrom are left
...
delete these two macros and all the associated stuff.
2005-03-16 16:11:11 +00:00
Hartmut Brandt
0bcbcabd26
Replace Lst_ForEach by LST_FOREACH.
2005-03-16 16:02:09 +00:00
Hartmut Brandt
a238417909
Replace another bunch of Lst_ForEachs by LST_FOREACHs and simplify code.
2005-03-16 12:22:15 +00:00
Hartmut Brandt
363fa56a62
Fix a comment.
2005-03-16 08:06:28 +00:00
Hartmut Brandt
0bcd542606
Get rid of another bunch of Lst_ForEach in favour of LST_FOREACH and
...
simplify code accordingly.
2005-03-16 08:04:45 +00:00
Hartmut Brandt
d2f389f5e4
Ups. Revert the last commits. These have been committed by accident.
2005-03-15 15:10:51 +00:00
Hartmut Brandt
d735bf8813
modifier_M: instead of going through the string twice to compute the
...
size of the buffer we need, just allocate the possible maximum.
Patch: 7.117
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-15 15:05:14 +00:00
Hartmut Brandt
77f4b22417
Style: Move a variable from a local scope up to the begin of the function.
...
Rename result variable so common code becomes more visible.
Rename freePtr to freeResult to make clear what pointer must be freed.
Patch: 7.116, 7.116a
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-15 14:52:10 +00:00
Hartmut Brandt
49fe6e22fd
Get rid of a number of Lst_ForEach calls in favour of LST_FOREACH
...
and simplify the printing functions.
2005-03-15 14:28:39 +00:00
Hartmut Brandt
ca98b031fd
VarParseLong: move the detection of the modifier separator ':' into
...
the loop. Add a comment why the 'consumed' variable is updated.
Rename lengthPtr to consumed.
Patch: 7.115
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-15 14:27:29 +00:00