From 365d1eb34dd41315b322bcb77acdca63060e533d Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Tue, 2 Jan 2024 02:14:17 +0100 Subject: [PATCH] Remove the old interpret_tilde functions --- utility/shared.cpp | 44 -------------------------------------------- utility/shared.h | 3 --- 2 files changed, 47 deletions(-) diff --git a/utility/shared.cpp b/utility/shared.cpp index c0cb749fb1..d7debef602 100644 --- a/utility/shared.cpp +++ b/utility/shared.cpp @@ -1122,50 +1122,6 @@ void free_multicast_group() mc_group = nullptr; } -/** - Interpret ~/ in filename as home dir - New path is returned in buf of size buf_size - - This may fail if the path is too long. It is better to use - interpret_tilde_alloc. - */ -void interpret_tilde(char *buf, size_t buf_size, const QString &filename) -{ - if (filename.startsWith(QLatin1String("~/"))) { - fc_snprintf(buf, buf_size, "%s/%s", qUtf8Printable(QDir::homePath()), - qUtf8Printable(filename.right(filename.length() - 2))); - } else if (filename == QLatin1String("~")) { - qstrncpy(buf, qUtf8Printable(QDir::homePath()), buf_size); - } else { - qstrncpy(buf, qUtf8Printable(filename), buf_size); - } -} - -/** - Interpret ~/ in filename as home dir - - The new path is returned in buf, as a newly allocated buffer. The new - path will always be allocated and written, even if there is no ~ present. - */ -char *interpret_tilde_alloc(const char *filename) -{ - if (filename[0] == '~' && filename[1] == '/') { - QString home = QDir::homePath(); - size_t sz; - char *buf; - - filename += 2; /* Skip past "~/" */ - sz = home.length() + qstrlen(filename) + 2; - buf = static_cast(fc_malloc(sz)); - fc_snprintf(buf, sz, "%s/%s", qUtf8Printable(home), filename); - return buf; - } else if (filename[0] == '~' && filename[1] == '\0') { - return fc_strdup(qUtf8Printable(QDir::homePath())); - } else { - return fc_strdup(filename); - } -} - /** * Interpret ~ in filename as home dir */ diff --git a/utility/shared.h b/utility/shared.h index 70287469cb..eec31edf4a 100644 --- a/utility/shared.h +++ b/utility/shared.h @@ -180,9 +180,6 @@ enum m_pre_result match_prefix_full(m_pre_accessor_fn_t accessor_fn, char *get_multicast_group(bool ipv6_preferred); void free_multicast_group(); -[[deprecated]] void interpret_tilde(char *buf, size_t buf_size, - const QString &filename); -[[deprecated]] char *interpret_tilde_alloc(const char *filename); QString interpret_tilde(const QString &filename); bool make_dir(const QString &pathname);