Commit Graph

52 Commits

Author SHA1 Message Date
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
363fa56a62 Fix a comment. 2005-03-16 08:06:28 +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
e23bc3a201 Some more easy constification.
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-04 07:51:00 +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
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
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
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
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
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
644a6874f9 Make needs no circular lists so remove them from the list code. 2004-12-07 10:14:16 +00:00
Hartmut Brandt
a82682c493 Some constification which doesn't require code rewrites. 2004-12-06 15:20:12 +00:00
Hartmut Brandt
595e513a56 Style: fix indentation. 2004-12-06 11:30:36 +00:00
Hartmut Brandt
d21474cec4 Style: remove a lot of unnecessary casts, add some and spell the null
pointer constant as NULL.

Checked by: diff -r on the object files before and after
2004-12-01 10:29:20 +00:00
Hartmut Brandt
e6417f6fe2 Stylification: missing spaces, extra space after function names, casts
and the sizeof operator, missing empty lines, void casts, extra empty lines.

Checked by: diff on make *.o lst.lib/*.o

Submitted by:	Max Okumoto <okumoto@soe.ucsd.edu> (partly)
2004-11-30 17:46:29 +00:00
Hartmut Brandt
e35e595f1d Change a couple of the primitve list functions to be macros. This changes
the semantic of Lst_Datum which formerly returned NULL when the argument
node was NULL. There was only one place in the source that relied on this
so change that place.
2004-11-30 10:35:04 +00:00
Ruslan Ermilov
21159d1687 Fix a bug that prevented exists() from finding "foo/", "foo/."
and "foo/.." when ".PATH: foo" was also given.

PR:		bin/34062
2003-10-02 21:30:30 +00:00
Ruslan Ermilov
faf94801fd - Cut out the code that caches the "." directory out of Dir_Init()
into a separate function, Dir_InitDot().

- Postpone the current and object directories detection (and caching
  of the "." directory) until after all command line arguments are
  parsed.  This makes the -C option DTRT.

PR:		bin/47149
2003-09-14 12:31:33 +00:00
Juli Mallett
4526ed6ffb Convert make(1) to use ANSI style function declarations. Variable
documentation already adequatedly existed in the description in most
cases.  Where it did not, it was added.  If no documentation existed
beforehand, then none was added.  Some unused dummies for use in the
traversal functions were marked as __unused during the conversion.
Occasionally, local style fixes were applied to lines already being
modified or influenced.

Now make(1) should always build with WARNS=3.
2002-10-09 03:42:10 +00:00
Juli Mallett
76e8db31fc Fix merge error in previous commit.
Sponsored by:	Bright Path Solutions
2002-09-28 20:04:17 +00:00
Juli Mallett
1e3d8881cf Add empty default cases where they should be, remove non-local execution stuff
in compat.c which doesn't even have preprocessor-conditional-hidden support
code, and add a debugging statement where we might end up with a nil list
somehow, but where I doubt it.

First confirmed userland kill for Flexelint.

Sponsored by:	Bright Path Solutions
2002-09-28 20:03:26 +00:00
Juli Mallett
2dbb6cf1cb Make the DEBUGF() macro portable by (ugh) adding a Debug() function, which
is merely printf() but to stderr.  This takes care of the caveat which lead
to the use of a vararg macro -- getting everything to stderr.
2002-09-18 16:13:03 +00:00
Juli Mallett
cdba64071c Move common use of if (DEBUG(FOO)) printf... to DEBUGF(FOO, ...), using
variable length arguments to a macro.  Bump version as this makes DEBUG
statements *always* go to stderr rather than sometimes stdout.  There are
a few stragglers, which I will take care of as soon as I can.  Mostly these
relate to the need-for-death-of some of the remote job code.

Nearby stylistic nits and XXX added/fixed where appropriate.
2002-09-17 22:31:26 +00:00
Juli Mallett
37721c8309 #define<space> -> #define<tab> 2002-09-17 21:29:06 +00:00
Juli Mallett
2431da5c7e Look for wildcards, and balanced meta-characters such as { and } like NetBSD
does.

Obtained from:	NetBSD
2002-06-20 19:41:21 +00:00
Juli Mallett
30617de0f3 Remove a stray asterisk in a comment. 2002-06-01 00:52:28 +00:00
Tom Rhodes
46c2a2cfa4 More consistancy. file system > filesystem 2002-05-16 02:19:14 +00:00
David E. O'Brien
9b24805230 Fix copyrights, and undo SCS ID damage. 2002-04-13 10:57:56 +00:00
David E. O'Brien
4d1f4209a6 Update SCM ID method. 2002-04-13 10:17:18 +00:00
David E. O'Brien
a59e308cd7 De'register. 2002-04-13 10:05:30 +00:00
Warner Losh
d3cb5ded92 remove __P 2002-03-22 01:33:25 +00:00
Ruslan Ermilov
f8532548a6 -Wall cleanup. 2001-04-25 14:45:36 +00:00
Will Andrews
2de6a43d0a Fix nasty bug where make(1) assumed that you could read the directory it
was in.  This shall be MFC'd in about three days (probably not a good idea
to MFC the stylistic changes though - see below).

PR:		19978
Submitted by:	Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
Patch by:	roam (slightly modified by me to use NULL not NIL)
2001-02-10 07:12:18 +00:00
Will Andrews
e3cb529472 Fix style(9) bug; use ISDOT[DOT,]() macro available in util.c by moving
it to make.h so both dir.c and util.c can use it, although bde didn't
particularly like this part of the idea, IMO it's cleaner than it was.

Submitted by:	bde
2001-01-21 08:24:41 +00:00
Will Andrews
111632fd99 Fix for the case where the first two entries returned by readdir() are
actually NOT '.' and '..'.  Apparently this isn't the case when accessing
a directory via XFS over NFS on SGI systems.  Since I don't have access to
an environment like that, this will sit out in -current for at least six
weeks.  However, the patch proposed by the submitter seems acceptable, so
I've decided to commit it to the tree, in the hope that it will solve some
problems without bringing up others.

PR:		23300
Submitted by:	Jim Pirzyk <Jim.Pirzyk@disney.com>
2000-12-26 07:36:07 +00:00
Will Andrews
1a1a8c9324 There's also no point in #typedef'ing void/char pointers. Accordingly,
rip out ClientData/Address pointers and use standard types.

Obtained from:	OpenBSD
2000-12-02 20:24:42 +00:00
Will Andrews
98c28d6cc5 There's no reason to use fancy forms of NULL. Replace all instances
of NIL, NILLST, NILLGNODE, etc. with NULL.

Obtained from:		OpenBSD
2000-12-02 18:58:01 +00:00
Wilfredo Sanchez
023944f435 Use __RCSID() 2000-07-09 02:54:54 +00:00
Tim Vanderhoek
06b1dcf182 Unduplicate IDs from comments, do $Id -> $FreeBSD$ (submitted-by: bde) 1999-09-11 13:08:02 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Tim Vanderhoek
9bd2d6eee4 Merge style- and trivial- only changes from OpenBSD (dated 1999/07/29-19:55+1).
Obtained from:	OpenBSD, sometimes indirected from NetBSD; myself
1999-08-17 00:39:26 +00:00
Peter Wemm
53faa0dade Revert $FreeBSD$ to $Id$ 1997-02-22 19:29:21 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Steve Price
5d55a64610 O' to be bitten by CVS. Cleanup after import
of Christos' version of make(1) and add Id's.

Set straight by: Bruce Evans and Peter Wemm :)
1996-10-08 04:07:59 +00:00
Steve Price
c0d06fe463 Merge in NetBSD's changes to make(1). Changes include:
- Add the .PHONY, .PARALLEL, and .WAIT directives
	- Added the -B and -m commandline flags
	- misc. man page cleanups
	- numerous job-related enhancements
	- removed unused header file (bit.h)
	- add util.c for functions not found in other envs.
	- and a few coordinated whitespace changes

Special thanks to Christos Zoulas <christos@netbsd.org>
for help in the merge.  A 'diff -ur' between Net and
FreeBSD now only contains sccsid-related diffs. :)

Obtained from: NetBSD, christos@netbsd.org, and me
1996-10-06 02:35:38 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00