Re: [PATCH] Name make_*_path functions more accurately

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Carlos MartÃn Nieto <cmn@xxxxxxxx> writes:

> Rename the make_*_path functions so it's clearer what they do, in
> particlar make clear what the differnce between make_absolute_path and
> make_nonrelative_path is by renaming them real_path and absolute_path
> respectively. make_relative_path has an understandable name and is
> renamed to relative_path to maintain the name convention.

The approach taken by this patch is a sound one, and I like it.  The
change does not reuse any existing name for different purpose, which means
there is little chance of this change interacting other topics that may be
in flight that introduce new call sites to these renamed functions in a
funny way.  A (semantic) mismerge or misapplication of the patch will be
found by the compiler.

For example, the version of setup.c this patch is based on the version
before 05f08e4 (Merge branch 'cb/setup', 2011-02-09) was merged, and the
merge introduced a new call site to make_absolute_path().  A few callsites
to make_nonrelative_path() in wrapper.c were introduced at 70ec868 (Merge
branch 'ae/better-template-failure-report', 2011-02-09), and this patch
does not touch them.

As the result, the patch cleanly applies textually, but the resulting code
does not compile, and it is a good thing ;-).


Here is a minor fix-up necessary when queuing this on top of master

 setup.c   |    2 +-
 wrapper.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/setup.c b/setup.c
index eae853a..03cd84f 100644
--- a/setup.c
+++ b/setup.c
@@ -9,7 +9,7 @@ char *prefix_path(const char *prefix, int len, const char *path)
 	const char *orig = path;
 	char *sanitized;
 	if (is_absolute_path(orig)) {
-		const char *temp = make_absolute_path(path);
+		const char *temp = real_path(path);
 		sanitized = xmalloc(len + strlen(temp) + 1);
 		strcpy(sanitized, temp);
 	} else {
diff --git a/wrapper.c b/wrapper.c
index 4c147d6..2829000 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -209,7 +209,7 @@ int xmkstemp(char *template)
 		if (!template[0])
 			template = origtemplate;
 
-		nonrelative_template = make_nonrelative_path(template);
+		nonrelative_template = absolute_path(template);
 		errno = saved_errno;
 		die_errno("Unable to create temporary file '%s'",
 			nonrelative_template);
@@ -344,7 +344,7 @@ int xmkstemp_mode(char *template, int mode)
 		if (!template[0])
 			template = origtemplate;
 
-		nonrelative_template = make_nonrelative_path(template);
+		nonrelative_template = absolute_path(template);
 		errno = saved_errno;
 		die_errno("Unable to create temporary file '%s'",
 			nonrelative_template);



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]