From 0d7ffe998f164cc39abb545a0e5d6a5e6c3a36a6 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Sat, 5 Mar 2011 14:22:06 -0600 Subject: [PATCH] Debugging output from doc-framework now only in debug mode. Also a minor format fix for documenting empty string lists. --- src/BroDoc.cc | 11 +++++++++-- src/BroDoc.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/BroDoc.cc b/src/BroDoc.cc index fb06a32308..8d734ab8e6 100644 --- a/src/BroDoc.cc +++ b/src/BroDoc.cc @@ -8,8 +8,9 @@ BroDoc::BroDoc(const std::string& sourcename) { +#ifdef DEBUG fprintf(stdout, "Documenting source: %s\n", sourcename.c_str()); - +#endif source_filename = sourcename.substr(sourcename.find_last_of('/') + 1); size_t ext_pos = source_filename.find_last_of('.'); @@ -35,8 +36,10 @@ BroDoc::BroDoc(const std::string& sourcename) if ( ! reST_file ) fprintf(stderr, "Failed to open %s", reST_filename.c_str()); +#ifdef DEBUG else fprintf(stdout, "Created reST document: %s\n", reST_filename.c_str()); +#endif } BroDoc::~BroDoc() @@ -104,7 +107,11 @@ void BroDoc::WriteStringList(const char* format, const char* last_format, const std::list& l) const { - if ( l.empty() ) return; + if ( l.empty() ) + { + WriteToDoc("\n"); + return; + } std::list::const_iterator it; std::list::const_iterator last = l.end(); last--; diff --git a/src/BroDoc.h b/src/BroDoc.h index 683a4cd5a5..adad10e3db 100644 --- a/src/BroDoc.h +++ b/src/BroDoc.h @@ -124,6 +124,7 @@ protected: /** * Writes out a list of strings to the reST document. + * If the list is empty, prints a newline character. * @param format A printf style format string for elements of the list * except for the last one in the list * @param last_format A printf style format string to use for the last