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
Ruslan Ermilov
83c7ade90a
NOSHARED -> NO_SHARED
2004-12-21 09:59:45 +00:00
Hartmut Brandt
5dd8ec0fd1
Fix compilation for the USE_KQUEUE case.
...
Submitted by: Emil Mikulic <emikulic@dmr.ath.cx>
2004-12-20 10:21:27 +00:00
Hartmut Brandt
0512b0a6c7
maxJobs is declared extern in job.h so it cannot be static in job.c.
...
PR: bin/75210
Submitted by: Andreas Jochens; Robert Millan <rmh@debian.org>
2004-12-20 10:14:05 +00:00
Hartmut Brandt
674a77f864
Remove all the cleanup functions. There is no reason to free memory
...
just before exiting (especially given the number of memory leaks) -
it just costs time.
2004-12-17 13:20:19 +00:00
Ruslan Ermilov
025bfb24c4
Fix a long-standing bug when make(1) is passed the -V and
...
-f options in MAKEFLAGS environment variable, and some of
these options are also specified on the command line.
Thanks to: marcel
Reviewed by: harti
2004-12-16 19:46:50 +00:00
Hartmut Brandt
1d614caea7
Instead of dynamically allocating list heads allocated them statically
...
now that their size is only two pointers. This eliminates a lot of calls
to Lst_Init and from there to malloc together with many calls to
Lst_Destroy (in places where the list is obviously empty). This also
reduces the chance to leave a list uninitilized so we can remove more
NULL pointer checks and probably eliminates a couple of memory leaks.
2004-12-16 16:14:16 +00:00
Hartmut Brandt
54bb820a75
Remove a list that was just used to free all variables just before exiting.
2004-12-10 11:58:34 +00:00
Hartmut Brandt
fadeed7fb8
Remove a list that used to hold all the GNodes just to be able
...
to free them just before exiting.
2004-12-10 10:32:10 +00:00
Hartmut Brandt
16fa982c70
Remove a useless list where just all command lines are stuffed onto, never
...
used and just freed at the end. The idea might have been to be able
to free all the strings, but what's the point to free just before exiting?
2004-12-10 10:13:40 +00:00
Hartmut Brandt
3cfcafb49a
Nobody actually checked the return codes from Lst_Append and Lst_Insert
...
so don't return anything.
2004-12-09 15:31:32 +00:00
Hartmut Brandt
0354c3e056
If a path element directory was never opened it is not on the list of
...
open directories so there is no need to remove it from there. This fixes
a core dump introduced by removing the run-time check from Lst_Remove.
2004-12-09 10:00:55 +00:00
Hartmut Brandt
4ec22b1196
Now that circular lists are gone remove stuff for them. Simplify
...
somewhat so that we can remove a local variable.
2004-12-08 17:48:15 +00:00
Hartmut Brandt
c81703e6a4
No caller checks the return code from Lst_Remove, so don't return one.
...
Simplify the algorithm now that circular lists are gone.
2004-12-08 17:43:43 +00:00
Hartmut Brandt
74c71bfc19
Don't check the return code from Lst_Remove. There is no way
...
that the list's first element is not on the list.
2004-12-08 16:50:14 +00:00
Hartmut Brandt
2e022816d8
Remove return value from Lst_Concat. None of the callers ever checked
...
it. Remove stuff that was needed for circular lists.
2004-12-08 16:47:19 +00:00
Hartmut Brandt
3220c0368c
Don't free the second list in Lst_Concat for LST_CONCLINK; free it
...
in the caller instead.
2004-12-08 16:28:53 +00:00
Hartmut Brandt
c76d7d5047
Get rid of the sequential access feature of the lists. This was used
...
only in a couple of places and all of them except for one were easily
converted to use Lst_First/Lst_Succ. The one place is compatibility
mode in job.c where the it was used to advance to the next command on
each invocation of JobStart. For this case add a pointer to the node to
hold the currently executed command.
2004-12-08 16:22:01 +00:00
Hartmut Brandt
db7ce92a3c
Constify the arguments to the list compare function. This temporarily
...
requires to make a copy of the filename in ReadMakefile and to duplicate
two small functions in suff.c. This hopefully will go away when everything
is constified.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (partly)
2004-12-08 12:59:27 +00:00
Hartmut Brandt
5d7406afd3
Constify some calls of Buf_AddBytes.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2004-12-08 08:18:13 +00:00
Hartmut Brandt
cb93e26c8a
Consify the arguments to str_concat. Remove the STR_DOFREE flag for that
...
purpose and explicitely free the input string in the one place that was
calling str_concat with that flag.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2004-12-08 08:11:59 +00:00
Hartmut Brandt
bf1ead0608
Typedefs of pointers to structs are evil. Make Lst and LstNode typedef of
...
the structs itself not of pointers to them. This will simplify constification.
Checked by: diff on the object files
2004-12-07 13:49:13 +00:00
Hartmut Brandt
b82f920f8e
Constification of arguments passed to functions; no change on the
...
resulting executable.
Checked by: diff on original and new objects
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2004-12-07 12:23:45 +00:00
Hartmut Brandt
644a6874f9
Make needs no circular lists so remove them from the list code.
2004-12-07 10:14:16 +00:00