diff options
author | Andreas Schuh <andreas.schuh.84@gmail.com> | 2017-07-12 00:30:41 +0100 |
---|---|---|
committer | Andreas Schuh <andreas.schuh.84@gmail.com> | 2017-07-13 16:28:54 +0100 |
commit | aa2d0f7b4ed11849f40c3a1dc573ac331ebdaebd (patch) | |
tree | c2957545ee8b09170c3fd0de6a851b6188b62658 | |
parent | 4663c80d3ab19fc7d9408fe8fb22b07b87c76e5a (diff) | |
download | gflags-aa2d0f7b4ed11849f40c3a1dc573ac331ebdaebd.tar.gz gflags-aa2d0f7b4ed11849f40c3a1dc573ac331ebdaebd.tar.bz2 gflags-aa2d0f7b4ed11849f40c3a1dc573ac331ebdaebd.zip |
fix: Remove obsolete and unused CleanFileName code
-rw-r--r-- | src/gflags.cc | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/gflags.cc b/src/gflags.cc index f270798..05aa40b 100644 --- a/src/gflags.cc +++ b/src/gflags.cc @@ -580,26 +580,14 @@ CommandLineFlag::~CommandLineFlag() { } const char* CommandLineFlag::CleanFileName() const { - // Compute top-level directory & file that this appears in - // search full path backwards. - // Stop going backwards at kRootDir; and skip by the first slash. - static const char kRootDir[] = ""; // can set this to root directory, - - if (sizeof(kRootDir)-1 == 0) // no prefix to strip - return filename(); - - const char* clean_name = filename() + strlen(filename()) - 1; - while ( clean_name > filename() ) { - if (*clean_name == PATH_SEPARATOR) { - if (sizeof(kRootDir) > 1 && strncmp(clean_name, kRootDir, sizeof(kRootDir)-1) == 0) { - clean_name += sizeof(kRootDir)-1; // past root-dir - break; - } - } - --clean_name; - } - while ( *clean_name == PATH_SEPARATOR ) ++clean_name; // Skip any slashes - return clean_name; + // This function has been used to strip off a common prefix from + // flag source file names. Because flags can be defined in different + // shared libraries, there may not be a single common prefix. + // Further, this functionality hasn't been active for many years. + // Need a better way to produce more user friendly help output or + // "anonymize" file paths in help output, respectively. + // Follow issue at: https://github.com/gflags/gflags/issues/86 + return filename(); } void CommandLineFlag::FillCommandLineFlagInfo( |