razor.c
changeset 57 016c61ca11e2
parent 56 9c00581c71be
child 59 c525dec02ef4
     1.1 --- a/razor.c	Wed Oct 24 00:05:42 2007 -0400
     1.2 +++ b/razor.c	Wed Oct 24 00:32:18 2007 -0400
     1.3 @@ -803,14 +803,15 @@
     1.4  		f = filenames[i].name;
     1.5  		if (*f != '/')
     1.6  			continue;
     1.7 +		f++;
     1.8  
     1.9  		d = &root;
    1.10  		while (*f) {
    1.11 -			end = strchr(f + 1, '/');
    1.12 +			end = strchr(f, '/');
    1.13  			if (end == NULL)
    1.14  				end = f + strlen(f);
    1.15 -			length = end - (f + 1);
    1.16 -			memcpy(dirname, f + 1, length);
    1.17 +			length = end - f;
    1.18 +			memcpy(dirname, f, length);
    1.19  			dirname[length] ='\0';
    1.20  			name = razor_importer_tokenize(importer, dirname);
    1.21  			if (d->last == NULL || d->last->name != name) {
    1.22 @@ -821,7 +822,9 @@
    1.23  				array_init(&d->last->packages);
    1.24  			}
    1.25  			d = d->last;				
    1.26 -			f = end;
    1.27 +			f = end + 1;
    1.28 +			if (*end == '\0')
    1.29 +				break;
    1.30  		}
    1.31  
    1.32  		r = array_add(&d->packages, sizeof *r);
    1.33 @@ -1100,13 +1103,9 @@
    1.34  	e = (struct razor_entry *) set->files.data + dir->start;
    1.35  	do {
    1.36  		n = pool + (e->name & RAZOR_ENTRY_MASK);
    1.37 -		len = strlen(n);
    1.38 -		if (len == 0)
    1.39 -			/* FIXME: Shouldn't have 0-length entries... */
    1.40 -			continue;
    1.41 -			
    1.42  		if (strcmp(pattern + 1, n) == 0)
    1.43  			return e;
    1.44 +		len = strlen(n);
    1.45  		if (e->start != 0 && strncmp(pattern + 1, n, len) == 0 &&
    1.46  		    pattern[len + 1] == '/') {
    1.47  			return find_entry(set, e, pattern + len + 1);