result = (char *)calloc(1, (3*levels + strlen(last_slash) + 1));
result = typecallocn(char, 3*levels + strlen(last_slash) + 1);
PUBLIC char * HTRelative ARGS2(	CONST char *,	aName,	CONST char *,	relatedName){    char * result = NULL;    CONST char *p = aName;    CONST char *q = relatedName;    CONST char * after_access = NULL;    CONST char * path = NULL;    CONST char * last_slash = NULL;    int slashes = 0;    for (; *p; p++, q++) {	/* Find extent of match */	if (*p != *q)	    break;	if (*p == ':')	    after_access = p+1;	if (*p == '/') {	    last_slash = p;	    slashes++;	    if (slashes == 3)		path=p;	}    }    /* q, p point to the first non-matching character or zero */    if (!after_access) {			/* Different access */	StrAllocCopy(result, aName);    } else if (slashes < 3){			/* Different nodes */	StrAllocCopy(result, after_access);    } else if (slashes == 3){			/* Same node, different path */	StrAllocCopy(result, path);    } else {					/* Some path in common */	int levels = 0;	for (; *q && (*q != '#'); q++)	    if (*q == '/')		levels++;	result = (char *)calloc(1, (3*levels + strlen(last_slash) + 1));	if (result == NULL)	    outofmem(__FILE__, "HTRelative");	result[0] = '\0';	for (; levels; levels--)	    strcat(result, "../");	strcat(result, last_slash+1);    }    CTRACE(tfp, "HT: `%s' expressed relative to\n    `%s' is\n   `%s'.",		aName, relatedName, result);    return result;}