150 lines
4.5 KiB
Plaintext
150 lines
4.5 KiB
Plaintext
$OpenBSD: patch-base_src_client_Resolver_c,v 1.2 2003/05/28 13:27:48 todd Exp $
|
|
--- base/src/client/Resolver.c.orig Sat Mar 29 16:15:28 2003
|
|
+++ base/src/client/Resolver.c Wed May 28 08:14:56 2003
|
|
@@ -66,7 +66,7 @@ resolve(Repository *repos, const char *a
|
|
OC_bool progress;
|
|
OC_bool no_matches = TRUE; /* until proven otherwise */
|
|
|
|
- r = (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ r = (Resolution *)calloc(1, sizeof(Resolution));
|
|
r->rest = xstrdup(arg);
|
|
|
|
log_trace(DBG_RESOLVER, "ARG is: %s\n", arg);
|
|
@@ -162,10 +162,10 @@ resolve(Repository *repos, const char *a
|
|
progress = FALSE;
|
|
|
|
for (u = 0; u < vec_size(vec); u++) {
|
|
- const char *fragment;
|
|
+ char *fragment;
|
|
|
|
r = vec_fetch(vec, u, Resolution *);
|
|
- fragment = r->rest;
|
|
+ fragment = (char *)r->rest;
|
|
|
|
if (fragment == 0 || r->tail == 0) {
|
|
/* This one is done. */
|
|
@@ -173,10 +173,12 @@ resolve(Repository *repos, const char *a
|
|
no_matches = FALSE;
|
|
continue;
|
|
}
|
|
+ fragment = xstrdup(r->rest);
|
|
|
|
pos = strchr(r->rest, '/');
|
|
|
|
if (pos) {
|
|
+ free(fragment);
|
|
fragment = xstrndup(r->rest, pos - r->rest);
|
|
while (*pos == '/')
|
|
pos++;
|
|
@@ -211,6 +213,7 @@ resolve(Repository *repos, const char *a
|
|
else if (nmequal(fragment, "top")) {
|
|
first = last = r->m->nRevisions - 1;
|
|
/* hack alert */
|
|
+ free(fragment);
|
|
fragment = xunsigned64_str(first);
|
|
}
|
|
|
|
@@ -219,11 +222,13 @@ resolve(Repository *repos, const char *a
|
|
DEFAULT(AnyException) {
|
|
}
|
|
END_CATCH;
|
|
- if (revs == NULL)
|
|
+ if (revs == NULL) {
|
|
+ free(fragment);
|
|
continue;
|
|
+ }
|
|
|
|
for (w = 0; w < vec_size(revs); w++) {
|
|
- const char *revno;
|
|
+ char *revno;
|
|
Resolution *nr;
|
|
|
|
rev = vec_fetch(revs, w, Revision *);
|
|
@@ -233,10 +238,12 @@ resolve(Repository *repos, const char *a
|
|
|
|
revno = xunsigned64_str(rev->seq_number);
|
|
|
|
- if (!glob_match(revno, fragment, 0))
|
|
+ if (!glob_match(revno, fragment, 0)) {
|
|
+ free(revno);
|
|
continue;
|
|
+ }
|
|
|
|
- nr = (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ nr = (Resolution *)calloc(1, sizeof(Resolution));
|
|
|
|
nr->fullPath = path_join(r->fullPath, revno);
|
|
nr->fp_frag = revno;
|
|
@@ -251,6 +258,7 @@ resolve(Repository *repos, const char *a
|
|
progress = TRUE;
|
|
|
|
no_matches = FALSE;
|
|
+ free(revno);
|
|
}
|
|
|
|
break;
|
|
@@ -295,6 +303,7 @@ resolve(Repository *repos, const char *a
|
|
DEFAULT(AnyException) {
|
|
}
|
|
END_CATCH;
|
|
+ free(fragment);
|
|
|
|
break;
|
|
}
|
|
@@ -362,8 +371,7 @@ resolve(Repository *repos, const char *a
|
|
with entities immediately, handle directories in a
|
|
second pass. */
|
|
if (*rest == 0) {
|
|
- Resolution *nr =
|
|
- (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ Resolution *nr = (Resolution *)calloc(1, sizeof(Resolution));
|
|
const char *newPath = path_join(r->fullPath, path_tail(match));
|
|
|
|
log_trace(DBG_RESOLVER, "New ent path is %s\n", newPath);
|
|
@@ -398,8 +406,7 @@ resolve(Repository *repos, const char *a
|
|
last = vec_fetch(dirlist, i, const char *);
|
|
|
|
{
|
|
- Resolution *nr =
|
|
- (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ Resolution *nr = (Resolution *)calloc(1, sizeof(Resolution));
|
|
const char *newPath;
|
|
|
|
newPath = last;
|
|
@@ -452,7 +459,7 @@ resolve(Repository *repos, const char *a
|
|
break;
|
|
}
|
|
|
|
- nr = (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ nr = (Resolution *)calloc(1, sizeof(Resolution));
|
|
|
|
nr->fullPath = path_join(r->fullPath, "home");
|
|
nr->fp_frag = xstrdup("home");
|
|
@@ -478,7 +485,7 @@ resolve(Repository *repos, const char *a
|
|
|
|
|
|
if (glob_match(de->key, fragment, 0)) {
|
|
- Resolution *nr = (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ Resolution *nr = (Resolution *)calloc(1, sizeof(Resolution));
|
|
|
|
/* FIX: This is SO broken!! */
|
|
URI *uri = uri_create(de->value);
|
|
@@ -540,7 +547,7 @@ resolve(Repository *repos, const char *a
|
|
if (!glob_match(m->name, fragment, 0))
|
|
continue;
|
|
|
|
- nr = (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ nr = (Resolution *)calloc(1, sizeof(Resolution));
|
|
|
|
nr->fullPath = path_join(r->fullPath, m->name);
|
|
nr->fp_frag = m->name;
|
|
@@ -568,7 +575,7 @@ resolve(Repository *repos, const char *a
|
|
to resurrect the glob match against the mutable name
|
|
for various reasons.. */
|
|
if (glob_match(uri, fragment, 0)) {
|
|
- Resolution *nr = (Resolution *)GC_MALLOC(sizeof(Resolution));
|
|
+ Resolution *nr = (Resolution *)calloc(1, sizeof(Resolution));
|
|
|
|
nr->fullPath = path_join(r->fullPath, fragment);
|
|
nr->fp_frag = uri;
|