Hartmut Brandt
1753d0e6a4
Add a debugging function that prints a message and appends the
...
current strerror.
2005-03-08 07:47:14 +00:00
Hartmut Brandt
a0aea18e18
Mark functions that don't return as dead.
2005-03-08 07:45:50 +00:00
Hartmut Brandt
34d49b885f
Finish constification of Var_Parse() and Var_Subst().
...
Patch: 0.18, 0.8, 7.110
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-08 07:43:57 +00:00
Hartmut Brandt
b37a89c4d4
Constify the callers of brk_string in this file.
...
Patch: 7.108
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:23:53 +00:00
Hartmut Brandt
f4d3f46b2e
Style: fix indendation of VarModify().
...
Patch: 7.107
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:14:50 +00:00
Hartmut Brandt
3cc51195c4
Constify the input argument to brk_string.
...
Patch: 7.106
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:10:39 +00:00
Hartmut Brandt
c4487a484d
Factor out the 'S' modifier into its own function. Move a variable
...
that is now used for both the 'M'/'N' branch and the 'S' branch of
the switch statement into a common scope.
Patch: 7.102-105
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:08:39 +00:00
Hartmut Brandt
ec3074aef1
Move the 'M' and 'N' modifiers into their own function.
...
Patch: 7.101
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-07 12:43:59 +00:00
Hartmut Brandt
573d78add6
Style: remove unneeded parantheses in conditionals.
2005-03-03 11:34:04 +00:00
Hartmut Brandt
b6bda8ea9d
Constify the code paths for the 'M' and 'N' modifiers.
...
Patch: 7.100
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-03 11:26:28 +00:00
Hartmut Brandt
179fc89109
Fix parsing of archives: in System V archive format the member names
...
is terminated with a slash. Although we are not System V, ar has
been configured to put that slash in. This format allows filenames
with trailing spaces.
2005-03-03 10:46:23 +00:00
Hartmut Brandt
5c78dee378
Fix parsing of archive specifications on the target side of
...
dependency lines. It seems that nobody is actually is using
the archive-feature of make.
2005-03-03 10:09:39 +00:00
Hartmut Brandt
49f5e8346a
Update the description comment of the function to reflect the
...
previous change.
2005-03-03 10:07:28 +00:00
Hartmut Brandt
d0330ee675
Transform VarParseLong() so that the lifetime and the constness of
...
variables gets clearer. Transform if() conditions to make the flow
clearer.
Patch: 7.93-99
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-03 07:25:04 +00:00
Hartmut Brandt
bf7c33df9c
Move the check for the error case (variable ends without a closing
...
paranthesis or brace) into the loop and don't leak the buffer in this
case. Remove the check for Var_Parse returning NULL - it can't.
Patch: 7.92
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-02 15:52:04 +00:00
Hartmut Brandt
b7beb62744
Fix indentation on a block of code.
...
Patch: 7.91
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-02 14:43:40 +00:00
Hartmut Brandt
09394f0073
Push the length computation down into VarParseShort().
...
Return always malloc()-ed strings from VarParseShort() to get
rid of warnings when returning string constants from a non-const char *
function.
Patch: 7.90
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-02 14:30:36 +00:00
Hartmut Brandt
c21044494f
Convert a function call to Lst_ForEach with a macro call to LST_FOREACH.
2005-03-02 12:00:21 +00:00
Hartmut Brandt
b93324d35e
Use the LST_FOREACH macro instead of the Lst_ForEach function. This
...
saves function calls and reduces void casting.
2005-03-02 08:30:49 +00:00
Hartmut Brandt
41664cddcd
Make sure the length variable is initialized to 0 before passing
...
it to Var_Parse().
Patch: 7.85
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-01 17:52:18 +00:00
Hartmut Brandt
f1c603af79
Split out ParseModifiers from VarParseLong.
...
Patch: 7.84
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-01 12:26:32 +00:00
Hartmut Brandt
73058038d5
VarParseLong: Create new else block for haveModifier. Move the call
...
to VarExpand down into the branches of the if as well as cleanup code.
Eliminate code that is now obviously dead.
Patch: 7.83
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-01 12:22:07 +00:00
Hartmut Brandt
aeadeefcdf
Reverse a condition so that the else clause can be changed
...
to a fallthrough.
Patch: 7.82
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-03-01 07:58:18 +00:00
Hartmut Brandt
4866acd4de
VarParseLong: Move the initialisation of dynamic up which saves
...
an else clause. Move the assignment to the lengthPtr down to
just before the return statements.
Patch: 7.81
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-28 17:23:17 +00:00
Hartmut Brandt
09fdd614d4
Buf_GetAll wants a pointer as its second argument, not a boolean -
...
replace FALSE by NULL.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-28 17:05:26 +00:00
Hartmut Brandt
9944ed62ba
Don't modify the input string in VarParseLong(). It is not
...
necessary to NUL-terminated it, because we know the lengths
from the pointers.
Patch: 7.80
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-28 15:01:37 +00:00
Hartmut Brandt
4ce3340f48
Major clean up and split the Var_Parse monster function into three
...
functions: one for the single letter variables, one for the others
and one that does the recursive expansion.
Patches: 7.68-7.79
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-26 08:54:40 +00:00
Hartmut Brandt
179078e76d
Change the return value of Var_Subst to return a Buffer instead
...
of a char *.
Patch: 7.49
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-25 13:16:56 +00:00
Hartmut Brandt
d057118357
Var_Parse: Separate different error states by introducing an else block
...
after a return. Move assignments to {freePtr, dynamic, start} closer to the
return statements to clarify which variables are actually used for
communication between the losely coupled blocks of the code. Clear up
an if-expression to make common structures of the conditions clearer.
Use strchr instead of switch statements to check for a character beeing
a member of a set.
Patches: 7-62.2, 7-62.3, 7-64, 7-65.1, 7-65.2
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-24 16:05:45 +00:00
Hartmut Brandt
a65e9283c5
Push assignments to just before the returns from the function to
...
get it clearer what variables are actually needed.
Patches: 7.62.2, 7.62.3
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-24 10:35:39 +00:00
Hartmut Brandt
0cb1c98b7a
Fix wording of a comment.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-24 10:30:23 +00:00
Hartmut Brandt
9a2bfd7ef5
Replace the calls to Lst_ForEach with the new LST_FOREACH macro and
...
fix the prototype for Compat_RunCommand to take the actual argument
types instead of void *.
2005-02-24 10:23:31 +00:00
Hartmut Brandt
592dcf0422
Use the LST_FOREACH macro instead of the Lst_ForEach function
...
and so get rid of the ForExec helper function by inlining it
into For_Run.
2005-02-23 14:03:18 +00:00
Hartmut Brandt
7175fefe00
Style: fix indent, use tabs instead of space+tab for aligning things.
...
Add a couple of comments.
2005-02-23 13:58:56 +00:00
Hartmut Brandt
09dd1bb9a1
Fix the indendation of some multi-line comments.
...
Noted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-23 10:20:58 +00:00
Hartmut Brandt
6a1865cdbb
Fix the prototypes by addings some constness. This should have been
...
committed together with the commit to dir.c:1.48.
2005-02-22 08:17:05 +00:00
Hartmut Brandt
e4597ce6ea
Use the new LST_FOREACH macro throughout the file and replace calls to
...
Lst_ForEach and Lst_Find.
2005-02-22 08:00:06 +00:00
Hartmut Brandt
36120d91e5
Invent the LST_FOREACH macro for looping through a list. In contrast
...
to the Lst_ForEach function this macro reduces the number of function
calls per invocation by N + 1 (where N is the number of list elements)
and increases code locality thereby increasing readability and
(maybe) performance.
2005-02-22 07:58:53 +00:00
Hartmut Brandt
1d2a8153d3
Style: fix indendation to be 8 and use tabulators. Fix lines longer than
...
80 characters and slightly reorder functions to get rid of static
prototypes.
2005-02-21 13:36:22 +00:00
Hartmut Brandt
6abaece6ae
Forgot to set *freePtr to FALSE in another place.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-21 08:10:21 +00:00
Hartmut Brandt
436834581b
Fix a bug in handling archive members: when a member was not found
...
when looking into an already hashed archive, the code tried to use
the name shortened to the maximum length allowed for the archive.
Unfortunately it passed a buffer of junk to the hashing routine when
the name actually wasn't too long. Theoretically this could lead to
a false positive.
2005-02-21 08:06:34 +00:00
Hartmut Brandt
7f2e1af188
Push the assignments of some variables down into the sub-blocks where
...
it is actually needed. This makes clear in which subblocks the variables
are not needed and which can easier be split out.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-18 15:32:06 +00:00
Hartmut Brandt
1aaa4432a5
Push down variables into local scope in Var_Parse to make their
...
liveness clear for splitting up this monster function.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-18 07:33:43 +00:00
Hartmut Brandt
5fdd47f89b
Whitespace cleanup: substitute mixed tabs and spaces by canonical
...
whitespace and line up some variable definitions.
2005-02-17 12:35:32 +00:00
Hartmut Brandt
b2a8c56e3a
Move error case to begin of if-else chain. Do not needless initialize
...
startc, but only at the place where the initialisation is needed. Remove
a needless else.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (partly)
2005-02-17 12:31:53 +00:00
Hartmut Brandt
3ff4a47ba0
Fix two typos in comments.
...
Submitted by: ru & Max Okumoto <okumoto@ucsd.edu>
2005-02-17 09:09:34 +00:00
Hartmut Brandt
768820f8c7
Sort out the error case that a single '$' was passed a little bit
...
earlier instead of mixing its handling with other cases.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-17 09:01:19 +00:00
Hartmut Brandt
46f05faa3a
Mostly stylistic issues: move a variable into local scope, make
...
condition positive and fix long lines.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-16 17:20:09 +00:00
Hartmut Brandt
5e431bae8f
Better version of the patch in 1.117: bring a variable into local scope
...
to prepare for function splitting and slightly reorganise the code
in anticipation of Var_Subst returning a Buffer.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (with slight changes)
2005-02-16 12:39:32 +00:00
Ruslan Ermilov
0227791b40
Expand *n't contractions.
2005-02-13 22:25:33 +00:00
Hartmut Brandt
0d63385639
Back out the previous commit. There is an obvious bug in it.
...
Pointy hat to: harti
2005-02-13 13:33:56 +00:00
Hartmut Brandt
157e401636
Stylistic fixes: push variable into a local context (this part is going
...
to be split out into a function soon). Also there is no need to write
back the colon that we have NUL-ed - the string is going to be freed
anyway.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-11 17:03:18 +00:00
Hartmut Brandt
40fe2aa311
Convert several instances of negative logic to positive logic.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-11 10:49:01 +00:00
Hartmut Brandt
26478079f7
Buffers are already NUL-terminated so there is no need to explicitely add
...
a NULL.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 17:01:46 +00:00
Hartmut Brandt
ed293d7304
Mostly stylistic nits in preparation for splitting up Var_Parse:
...
use a more consistent style with regard to *str and str[0];
simplify code by introducing a temporary variable;
shift a break around and add braces where appropriate.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 17:00:16 +00:00
Hartmut Brandt
42e4f1252b
Let the buffer just use the default size by specifying 0 as the size
...
instead of specifying the default size explicitely.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:53:29 +00:00
Hartmut Brandt
c738c9b125
Mark the modification of the input string (which should really be const)
...
with a comment.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:52:14 +00:00
Hartmut Brandt
302288aba2
Style nits:
...
Move some assignments nearer to where they actually used. Convert a loop
from a for() to a while() to make it clearer and add braces to the long
body of it. Split assignment from variable declaration.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:50:34 +00:00
Hartmut Brandt
d2bda84a20
Describe a pre-condition of Var_Parse().
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:43:22 +00:00
Hartmut Brandt
f804a7b3b1
Remove a comment that's not actual anymore.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:41:22 +00:00
Hartmut Brandt
5cb05d7962
Fix spacing by converting mixes of space and tab to tab. Also add a number
...
of empty lines in appropriate places.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:39:05 +00:00
Hartmut Brandt
96089951e4
Initialise the status variable. W_SETTERMSIG uses its value.
...
Submitted by: stefanf
2005-02-10 14:32:14 +00:00
Hartmut Brandt
51079b278c
Lst_Append returns void, so the other case of the ? statement
...
should also be void.
Submitted by: stefanf
2005-02-10 14:25:12 +00:00
Hartmut Brandt
2890fef88d
Use defines for character constants for open and closing braces and
...
parantheses. This helps editors to find its way through the horrible
mess of Var_Parse. Rewrite a for() loop into a while() to make it clearer.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-09 18:44:09 +00:00
Hartmut Brandt
83307acd08
While working on constification temporarily disable -Werror. Things are too
...
twisted.
2005-02-09 13:22:02 +00:00
Hartmut Brandt
f2b48f62c6
Untangle VarFind and, while rewriting most of the function, fix the
...
intendation. (A large part of the function was already at intendation 8).
2005-02-09 13:13:59 +00:00
Hartmut Brandt
3f18a493f4
Introduce VarCreate and VarDestroy functions and used them where
...
appropriate.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-09 09:53:28 +00:00
Hartmut Brandt
76749b8672
Remove an unneeded check.
2005-02-07 16:33:57 +00:00
Hartmut Brandt
9be6b372de
Introduce a typedef for variable value modifation functions and use it
...
where appropriate.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 16:27:19 +00:00
Hartmut Brandt
b3c3341784
Make the intention of a loop clearer.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 15:51:51 +00:00
Hartmut Brandt
46ca434737
Introduce Buf_StripNewLines() and use it where appropriate.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 11:27:47 +00:00
Hartmut Brandt
ae9eed1281
Invent a Buf_AppendRange function that appends a non-NUL-terminated string
...
given by a pointer to the start of the string and a pointer one behind
the end.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 07:54:23 +00:00
Hartmut Brandt
d01d6678ad
Invent a Buf_Append function to append a NUL-terminated string
...
and use it thoughout the code.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 07:49:16 +00:00
Hartmut Brandt
2e0af0312e
Where the returned line length from Buf_GetAll is not used just pass
...
a NULL to the function. Delete the now unused local variables.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 16:53:35 +00:00
Hartmut Brandt
f4dd241033
Rewrite of the buf code:
...
- convert Buf_AddByte from a macro to a function
- move #define's into the header file
- remove unused field in struct Buffer
- remove size fields - they can be easily computed
- inline Buf_OvAddByte
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 16:48:35 +00:00
Hartmut Brandt
b8900c134b
None of the users of Buf_Discard used it to get rid of only a part of
...
the buffer. So replace Buf_Discard by Buf_Clear which just gets rid
of the entire contents.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:34:16 +00:00
Hartmut Brandt
8e1c246001
Inline the ADDWORD() macro in the two places where it is used. It just
...
obfuscates the code.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:29:50 +00:00
Hartmut Brandt
c8bd426d66
Use _exit() instead of exit() when the exec() after a vfork() fails.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:26:37 +00:00
Hartmut Brandt
8ffb687e64
Move PrintAddr() from util.c into suff.c - the only file where it is
...
actuall used, and make it static.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:23:39 +00:00
Hartmut Brandt
ce8c7083f4
General whitespace cleanup: remove mixes of tabs and spaces, remove
...
space after function names, remove spaces on emtpy lines.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 12:38:57 +00:00
Hartmut Brandt
435916b011
Minor cleanup: make brk_string to return argc only if the pointer to it
...
was non-NULL. This let's us eliminated an otherwise unused variable.
shellneeded can never return -1 so there is no need to check for it and
hence no need for a variable to hold the returned value.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (partly)
2005-02-04 12:30:54 +00:00
Hartmut Brandt
acd5b69dd1
Further constification. Use a temporary hack (copying the input string)
...
until Var_Subst is fixed.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 12:10:20 +00:00
Hartmut Brandt
8cfa18d178
Use an extra variable to assign to instead of missusing an input
...
parameter. This will help in constification.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 08:31:42 +00:00
Hartmut Brandt
fec9b45897
Replace space, tab mixes by tabs.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 08:15:11 +00:00
Hartmut Brandt
f6dc7bd983
Use tabs to move to the comments instead of wild mixes of tabs and spaces.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 08:11:58 +00:00
Hartmut Brandt
a9fe0a1150
Style: line up with tabulators.
2005-02-04 08:03:55 +00:00
Hartmut Brandt
141d5e9f62
Use a typedef for the conditional handler function so that declaring
...
pointers to these functions is easier.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 08:02:41 +00:00
Hartmut Brandt
7a551242f8
Style: remove a space between a function name and the opening
...
paranthesis.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 07:56:40 +00:00
Hartmut Brandt
e23bc3a201
Some more easy constification.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 07:51:00 +00:00
Hartmut Brandt
b26f9f6376
Constify an argument to a function.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-03 11:51:25 +00:00
Hartmut Brandt
9ba5835fba
Get rid of a number of unneccessary memory allocations.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-03 11:36:19 +00:00
Hartmut Brandt
b09fe25c80
Make enomem static - it's referenced only in util.c.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-02 11:25:05 +00:00
Hartmut Brandt
6f8d22e416
Remove a couple of unused buffer functions.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-02 11:21:26 +00:00
Hartmut Brandt
ab9e1eb050
Convert several typedefs from beeing pointers to structs to be the structs
...
itself. This will ease constification (think of what 'const Ptr foo'
means if Ptr is a pointer to a struct).
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-02 07:36:18 +00:00
Hartmut Brandt
44ad9c662f
Move all the remaining list functions into one C-file and remove
...
double documentation comments. Remove the 3rd clause (from 4) of the
BSD license because these files have only the UCB copyright.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-01 15:28:41 +00:00
Hartmut Brandt
042037eb6f
Remove debugging stuff that crept in in the previous commit.
2005-02-01 11:39:45 +00:00
Hartmut Brandt
7a2029bac2
Clean up include files and file including. Split nonints.h into pieces
...
that get included just where they are needed. All headers include the
headers that they need to compile (just with an empty .c file). Sort
includes alphabetically where apropriate and fix some duplicate commenting
for struct Job, struct GNode and struct Shell by removing one version and
inlining the comments into the structure declaration (the comments have been
somewhat outdated).
This patch does not contain functional changes (checked with md5).
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-01 10:50:37 +00:00
Hartmut Brandt
b071ad2dca
Fix quoting of the MAKEFLAGS environment variable by only quoting spaces
...
and tabs. This is still not correct for command line variable values
ending in a backslash because this would require a larger effort.
Document this limitation in the BUGS section of the man page. The
quoting is mostly compatible with that of gmake and smake.
Tested by: Max Okumoto and Joerg Sonnenberger from DragonFly BSD
Reviewed by: ru (man page, partly)
2005-01-26 18:19:39 +00:00
Ruslan Ermilov
6c7216df78
Sort sections.
2005-01-18 13:43:56 +00:00
Ruslan Ermilov
4438d91ea2
Scheduled mdoc(7) sweep.
2005-01-11 10:32:52 +00:00