/* Construct a string representing the symbolic link target for the given gcov data file name and link type. Depending on the link type and the location of the data file, the link target can either point to a subdirectory of srctree, objtree or in an external location.  */
static char* get_link_target(const char *filename, const struct gcov_link *ext)
/* Construct a string representing the symbolic link target for the given gcov data file name and link type. Depending on the link type and the location of the data file, the link target can either point to a subdirectory of srctree, objtree or in an external location.  */
static char* get_link_target(const char *filename, const struct gcov_link *ext)
{
	const char *rel;
	char *result;
	if (strncmp(filename, objtree, strlen(objtree)) == 0) {
		rel = filename + strlen(objtree) + 1;
		if (ext->dir == SRC_TREE)
			result = link_target(srctree, rel, ext->ext);
		else
			result = link_target(objtree, rel, ext->ext);
	} else {
		result = link_target(NULL, filename, ext->ext);
	}
	return result;
}