Github user SolidWallOfCode commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/274#discussion_r36782875 --- Diff: lib/ts/BaseLogFile.cc --- @@ -0,0 +1,571 @@ +/** @file + + Base class for log files implementation + + @section license License + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#include "BaseLogFile.h" + +/* + * This consturctor creates a BaseLogFile based on a given name. + * This is the most common way BaseLogFiles are created. + */ +BaseLogFile::BaseLogFile(const char *name) + : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), m_has_signature(false), m_signature(0), m_is_init(false) +{ + m_fp = NULL; + m_start_time = time(0); + m_end_time = 0L; + m_bytes_written = 0; + m_meta_info = NULL; + + log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", m_name, this); +} + +/* + * This consturctor creates a BaseLogFile based on a given name. + * Similar to above constructor, but is overloaded with the object signature + */ +BaseLogFile::BaseLogFile(const char *name, uint64_t sig) --- End diff -- If there's really no good default value to signal not passed, you may have to just have these two. A couple of mitigations - If you're going to do member initialization via assignment anyway, you could create an `init` method that is called from the constructors to do that thereby not duplicating the code. More obscurely I have created a super class with the common constructed members and used private or protected inheritance because no client cares about that, but you can then unify the common member initialization there. Some people frown on that, though, because it splits the member declarations from the "real" class. Note that you don't need to qualify any of the member names when used later.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---