preceded by 2N backslashes represents N backslashes at
the end of a file name; and backslashes in other
contexts should not be doubled. */
- for (q = p - 1; q < filename && q[-1] == '\\'; q--)
+ for (q = p - 1; filename <= q && *q == '\\'; q--)
len++;
len++;
break;
{
case ' ':
case '\t':
- for (q = p - 1; filename < q && q[-1] == '\\'; q--)
+ for (q = p - 1; filename <= q && *q == '\\'; q--)
*dst++ = '\\';
*dst++ = '\\';
break;
/* Given a pathname, calculate the non-directory part. This always
knows how to handle Unix-style pathnames, and understands VMS and
DOS paths on those systems. */
+
/* Find the base name of a (partial) pathname FNAME.
Returns a pointer into the string passed in.
Accepts Unix (/-separated) paths on all systems,
DOS and VMS paths on those systems. */
+
static const char *
base_name (fname)
const char *fname;
/* Allocate space for the vectors now. */
- d->targetv = xmalloc (2 * sizeof (const char *));
- d->depv = xmalloc (8 * sizeof (const char *));
+ d->targetv = (const char **) xmalloc (2 * sizeof (const char *));
+ d->depv = (const char **) xmalloc (8 * sizeof (const char *));
d->ntargets = 0;
d->targets_size = 2;
struct deps *d;
{
unsigned int i;
+
for (i = 0; i < d->ntargets; i++)
free ((PTR) d->targetv[i]);
+
for (i = 0; i < d->ndeps; i++)
free ((PTR) d->depv[i]);
if (d->ntargets == d->targets_size)
{
d->targets_size *= 2;
- d->targetv = xrealloc (d->targetv,
+ d->targetv = (const char **) xrealloc (d->targetv,
d->targets_size * sizeof (const char *));
}
+
d->targetv[d->ntargets++] = t;
}
char *o, *suffix;
t = base_name (t);
- o = alloca (strlen (t) + 8);
+ o = (char *) alloca (strlen (t) + 8);
strcpy (o, t);
suffix = strrchr (o, '.');
if (d->ndeps == d->deps_size)
{
d->deps_size *= 2;
- d->depv = xrealloc (d->depv, d->deps_size * sizeof (const char *));
+ d->depv = (const char **)
+ xrealloc (d->depv, d->deps_size * sizeof (const char *));
}
d->depv[d->ndeps++] = t;
}
const struct deps *d;
FILE *fp;
{
- int i;
+ unsigned int i;
for (i = 1; i < d->ndeps; i++)
{