Changeset 074ddc0 in subsurface


Ignore:
Timestamp:
Dec 14, 2017, 8:01:05 AM (6 weeks ago)
Author:
Jan Mulder <jlmulder@…>
Branches:
master
Children:
c21e998
Parents:
375490d
git-author:
Berthold Stoeger <bstoeger@…> (12/13/17 11:10:04)
git-committer:
Jan Mulder <jlmulder@…> (12/14/17 08:01:05)
Message:

Remove function isCloudUrl()

The function isCloudUrl() was only called in one place, parse_file().
But, isCloudUrl() could only return true if the filename was of the
git-repository kind (url[branch]). In such a case, control flow would
never reach the point where isCloudUrl() is called, since
is_git_repository() returns non-NULL and the function returns early.

Therefore, remove this function. Moreover, adapt the affected if-statement
by replacing "str && !strcmp(str, ...)" with the more concise
"same_string(str, ...)".

Signed-off-by: Berthold Stoeger <bstoeger@…>

Location:
core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • core/file.c

    re25cecf r074ddc0  
    498498
    499499        if ((ret = readfile(filename, &mem)) < 0) {
    500                 /* we don't want to display an error if this was the default file or the cloud storage */
    501                 if ((prefs.default_filename && !strcmp(filename, prefs.default_filename)) ||
    502                     isCloudUrl(filename))
     500                /* we don't want to display an error if this was the default file  */
     501                if (same_string(filename, prefs.default_filename))
    503502                        return 0;
    504503
  • core/qthelper.cpp

    rae26875 r074ddc0  
    14501450}
    14511451
    1452 extern "C" bool isCloudUrl(const char *filename)
    1453 {
    1454         QString email = QString(prefs.cloud_storage_email);
    1455         email.replace(QRegularExpression("[^a-zA-Z0-9@._+-]"), "");
    1456         if (!email.isEmpty() &&
    1457             QString(QString(prefs.cloud_git_url) + "/%1[%1]").arg(email) == filename)
    1458                 return true;
    1459         return false;
    1460 }
    1461 
    14621452extern "C" bool getProxyString(char **buffer)
    14631453{
  • core/qthelperfromc.h

    ra9ceecc r074ddc0  
    66bool canReachCloudServer();
    77void updateWindowTitle();
    8 bool isCloudUrl(const char *filename);
    98void subsurface_mkdir(const char *dir);
    109char *get_file_name(const char *fileName);
Note: See TracChangeset for help on using the changeset viewer.