Commit a4143077 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

addressed a review comment:

 - removed destroyAuthConfigParser()
 - adjusted the test code and documentation accordingly

git-svn-id: svn:// e5f2f494-b856-4b98-b285-d166d9295462
parent 7ccec239
......@@ -164,7 +164,7 @@ MemoryDatasourceConfig::build(ConstElementPtr config_value) {
// This is a generalized version of create function that can create
// a AuthConfigParser object for "internal" use.
// an AuthConfigParser object for "internal" use.
createAuthConfigParser(AuthSrv& server, const std::string& config_id,
bool internal)
......@@ -189,11 +189,6 @@ createAuthConfigParser(AuthSrv& server, const std::string& config_id) {
return (createAuthConfigParser(server, config_id, false));
destroyAuthConfigParser(AuthConfigParser* parser) {
delete parser;
configureAuthServer(AuthSrv& server, ConstElementPtr config_set) {
if (!config_set) {
......@@ -163,8 +163,13 @@ void configureAuthServer(AuthSrv& server,
/// In practice, this function is only expected to be used as a backend of
/// \c configureAuthServer() and is not supposed to be called directly
/// by applications. It is publicly available mainly for testing purposes.
/// When called directly, the created object must be destroyed using the
/// \c destroyAuthConfigParser() function.
/// When called directly, the created object must be deleted by the caller.
/// Note: this means if this module and the caller use incompatible sets of
/// new/delete, it may cause unexpected strange failure. We could avoid that
/// by providing a separate deallocation function or by using a smart pointer,
/// but since the expected usage of this function is very limited (i.e. for
/// our own testing purposes) it would be an overkilling. We therefore prefer
/// simplicity and keeping the interface intuitive.
/// If the resource allocation for the new object fails, a corresponding
/// standard exception will be thrown. Otherwise this function is not
......@@ -178,21 +183,6 @@ void configureAuthServer(AuthSrv& server,
AuthConfigParser* createAuthConfigParser(AuthSrv& server,
const std::string& config_id);
/// Destroy an \c AuthConfigParser object.
/// This function destructs the \c parser and frees resources allocated for
/// it. \c parser must have been created by \c createAuthConfigParser().
/// Like the create function, this function is mainly intended to be used
/// for testing purposes; normal applications are not expected to call it
/// directly.
/// This function is not expected to throw an exception unless the underlying
/// implementation of \c parser (an object of a specific derived class of
/// \c AuthConfigParser) throws.
/// \param parser A pointer to an \c AuthConfigParser object to be destroyed.
void destroyAuthConfigParser(AuthConfigParser* parser);
#endif // __CONFIG_H
// Local Variables:
......@@ -109,7 +109,7 @@ protected:
parser(createAuthConfigParser(server, "datasources"))
~MemoryDatasrcConfigTest() {
delete parser;
AuthConfigParser* parser;
......@@ -170,7 +170,7 @@ TEST_F(MemoryDatasrcConfigTest, replace) {
// create a new parser, and install a new set of configuration. It
// should replace the old one.
delete parser;
parser = createAuthConfigParser(server, "datasources");
"[{\"type\": \"memory\","
......@@ -193,7 +193,7 @@ TEST_F(MemoryDatasrcConfigTest, remove) {
EXPECT_EQ(1, server.getMemoryDataSrc(rrclass)->getZoneCount());
delete parser;
parser = createAuthConfigParser(server, "datasources");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment