Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_Logger: remove short-filename compatability code #27478

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 1 addition & 34 deletions libraries/AP_Logger/AP_Logger_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,26 +366,12 @@ void AP_Logger_File::Prep_MinSpace()
} while (log_to_remove != first_log_to_remove);
}

/*
construct a log file name given a log number.
The number in the log filename will *not* be zero-padded.
Note: Caller must free.
*/
char *AP_Logger_File::_log_file_name_short(const uint16_t log_num) const
{
char *buf = nullptr;
if (asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num) == -1) {
return nullptr;
}
return buf;
}

/*
construct a log file name given a log number.
The number in the log filename will be zero-padded.
Note: Caller must free.
*/
char *AP_Logger_File::_log_file_name_long(const uint16_t log_num) const
char *AP_Logger_File::_log_file_name(const uint16_t log_num) const
{
char *buf = nullptr;
if (asprintf(&buf, "%s/%08u.BIN", _log_directory, (unsigned)log_num) == -1) {
Expand All @@ -394,25 +380,6 @@ char *AP_Logger_File::_log_file_name_long(const uint16_t log_num) const
return buf;
}

/*
return a log filename appropriate for the supplied log_num if a
filename exists with the short (not-zero-padded name) then it is the
appropirate name, otherwise the long (zero-padded) version is.
Note: Caller must free.
*/
char *AP_Logger_File::_log_file_name(const uint16_t log_num) const
{
char *filename = _log_file_name_short(log_num);
if (filename == nullptr) {
return nullptr;
}
if (file_exists(filename)) {
return filename;
}
free(filename);
return _log_file_name_long(log_num);
}

/*
return path name of the lastlog.txt marker file
Note: Caller must free.
Expand Down
2 changes: 0 additions & 2 deletions libraries/AP_Logger/AP_Logger_File.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ class AP_Logger_File : public AP_Logger_Backend

/* construct a file name given a log number. Caller must free. */
char *_log_file_name(const uint16_t log_num) const;
char *_log_file_name_long(const uint16_t log_num) const;
char *_log_file_name_short(const uint16_t log_num) const;
char *_lastlog_file_name() const;
uint32_t _get_log_size(const uint16_t log_num);
uint32_t _get_log_time(const uint16_t log_num);
Expand Down
Loading