From: Razvan Becheriu Date: Wed, 7 Apr 2021 11:28:35 +0000 (+0300) Subject: [#1680] removed unused function referencing unsafe localtime X-Git-Tag: Kea-1.9.8~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=745e4570f201b5bbc0d89bd80d42c2baa6ba5e50;p=thirdparty%2Fkea.git [#1680] removed unused function referencing unsafe localtime --- diff --git a/src/lib/log/compiler/message.cc b/src/lib/log/compiler/message.cc index 009084837d..a62d129d36 100644 --- a/src/lib/log/compiler/message.cc +++ b/src/lib/log/compiler/message.cc @@ -60,7 +60,6 @@ using namespace isc::util; /// help message (and exits). -d <dir> will make it write the /// output file(s) to dir instead of current working directory - /// \brief Print Version /// /// Prints the program's version number. @@ -86,29 +85,6 @@ usage() { " is the name of the input message file.\n"; } - -/// \brief Create Time -/// -/// Returns the current time as a suitably-formatted string. -/// -/// \return Current time - -string -currentTime() { - - // Get a text representation of the current time. - time_t curtime; - time(&curtime); - struct tm* timeinfo; - timeinfo = localtime(&curtime); - - char buffer[80]; - strftime(buffer, 80, "%a %b %d %Y %H:%M", timeinfo); - - return (std::string(buffer)); -} - - /// \brief Create Header Sentinel /// /// Given the name of a file, create an \#ifdef sentinel name. The name is @@ -129,7 +105,6 @@ sentinel(Filename& file) { return (sentinel_text); } - /// \brief Quote String /// /// Inserts an escape character (a backslash) prior to any double quote @@ -156,7 +131,6 @@ quoteString(const string& instring) { return (outstring); } - /// \brief Sorted Identifiers /// /// Given a dictionary, return a vector holding the message IDs in sorted @@ -179,7 +153,6 @@ sortedIdentifiers(MessageDictionary& dictionary) { return (ident); } - /// \brief Split Namespace /// /// The $NAMESPACE directive may well specify a namespace in the form a::b. @@ -209,7 +182,6 @@ splitNamespace(string ns) { return (isc::util::str::tokens(ns, ":")); } - /// \brief Write Opening Namespace(s) /// /// Writes the lines listing the namespaces in use. @@ -225,7 +197,6 @@ writeOpeningNamespace(ostream& output, const vector& ns) { } } - /// \brief Write Closing Namespace(s) /// /// Writes the lines listing the namespaces in use. @@ -254,11 +225,11 @@ writeClosingNamespace(ostream& output, const vector& ns) { /// \param output_directory if not null NULL, output files are written /// to the given directory. If NULL, they are written to the current /// working directory. - void -writeHeaderFile(const string& file, const vector& ns_components, - MessageDictionary& dictionary, const char* output_directory) -{ +writeHeaderFile(const string& file, + const vector& ns_components, + MessageDictionary& dictionary, + const char* output_directory) { Filename message_file(file); Filename header_file(Filename(message_file.name()).useAsDefault(".h")); if (output_directory != NULL) { @@ -317,17 +288,14 @@ writeHeaderFile(const string& file, const vector& ns_components, hfile.close(); } - /// \brief Convert Non Alpha-Numeric Characters to Underscores /// /// Simple function for use in a call to transform - char replaceNonAlphaNum(char c) { return (isalnum(c) ? c : '_'); } - /// \brief Write Program File /// /// Writes the C++ source code file. This defines the text of the message @@ -362,10 +330,10 @@ replaceNonAlphaNum(char c) { /// to the given directory. If NULL, they are written to the current /// working directory. void -writeProgramFile(const string& file, const vector& ns_components, +writeProgramFile(const string& file, + const vector& ns_components, MessageDictionary& dictionary, - const char* output_directory) -{ + const char* output_directory) { Filename message_file(file); Filename program_file(Filename(message_file.name()).useAsDefault(".cc")); if (output_directory) { @@ -424,7 +392,6 @@ writeProgramFile(const string& file, const vector& ns_components, quoteString(dictionary.getText(*i)) << "\",\n"; } - // ... and the postamble ccfile << " NULL\n" << @@ -445,14 +412,12 @@ writeProgramFile(const string& file, const vector& ns_components, ccfile.close(); } - /// \brief Error and exit if there are duplicate entries /// /// If the input file contained duplicate message IDs, we print an /// error for each of them, then exit the program with a non-0 value. /// /// \param reader Message Reader used to read the file - void errorDuplicates(MessageReader& reader) { @@ -474,12 +439,10 @@ errorDuplicates(MessageReader& reader) { } } - /// \brief Main Program /// /// Parses the options then dispatches to the appropriate function. See the /// main file header for the invocation. - int main(int argc, char* argv[]) { @@ -570,5 +533,4 @@ main(int argc, char* argv[]) { } return (0); - }