From: Jordan Lee Date: Mon, 4 Feb 2013 21:53:19 +0000 (+0000) Subject: (trunk) prefer tr_remove() to unlink() or rmdir() X-Git-Tag: 2.80~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=445609f690ffbf81986ad0d618fdb11ff2e4bb0a;p=transmission (trunk) prefer tr_remove() to unlink() or rmdir() --- diff --git a/gtk/util.c b/gtk/util.c index fd431b913..03424221b 100644 --- a/gtk/util.c +++ b/gtk/util.c @@ -17,7 +17,6 @@ #include #include -#include /* g_unlink () */ #include /* g_file_trash () */ #include /* TR_RATIO_NA, TR_RATIO_INF */ diff --git a/libtransmission/blocklist.c b/libtransmission/blocklist.c index b4d77f448..994070296 100644 --- a/libtransmission/blocklist.c +++ b/libtransmission/blocklist.c @@ -16,7 +16,7 @@ #include /* bsearch (), qsort () */ #include -#include /* unlink () */ +#include /* close () */ #ifdef WIN32 #include @@ -139,7 +139,7 @@ static void blocklistDelete (tr_blocklistFile * b) { blocklistClose (b); - unlink (b->filename); + tr_remove (b->filename); } /*** diff --git a/libtransmission/metainfo.c b/libtransmission/metainfo.c index 4e3a7c35b..c8bfbe15c 100644 --- a/libtransmission/metainfo.c +++ b/libtransmission/metainfo.c @@ -16,7 +16,7 @@ #include /* strlen () */ #include -#include /* unlink, stat */ +#include /* stat */ #include @@ -587,7 +587,7 @@ tr_metainfoRemoveSaved (const tr_session * session, const tr_info * inf) char * filename; filename = getTorrentFilename (session, inf); - unlink (filename); + tr_remove (filename); tr_free (filename); } diff --git a/libtransmission/resume.c b/libtransmission/resume.c index 5767b64fd..2d54e23cb 100644 --- a/libtransmission/resume.c +++ b/libtransmission/resume.c @@ -10,8 +10,6 @@ * $Id$ */ -#include /* unlink */ - #include #include "transmission.h" @@ -923,6 +921,6 @@ void tr_torrentRemoveResume (const tr_torrent * tor) { char * filename = getResumeFilename (tor); - unlink (filename); + tr_remove (filename); tr_free (filename); } diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 7b884fba8..2572b53e6 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -15,7 +15,6 @@ #include #include /* strtol */ #include /* strcmp */ -#include /* unlink */ #ifdef HAVE_ZLIB #include @@ -1490,7 +1489,7 @@ gotNewBlocklist (tr_session * session, tr_snprintf (result, sizeof (result), "success"); } - unlink (filename); + tr_remove (filename); tr_free (filename); tr_free (buf); } diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 31f10e009..215f01b3f 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -2921,7 +2921,7 @@ deleteLocalData (tr_torrent * tor, tr_fileFunc func) removeEmptyFoldersAndJunkFiles (tr_ptrArrayNth (&folders, i)); /* cleanup */ - rmdir (tmpdir); + tr_remove (tmpdir); tr_free (tmpdir); tr_ptrArrayDestruct (&folders, tr_free); tr_ptrArrayDestruct (&files, tr_free); diff --git a/libtransmission/utils.c b/libtransmission/utils.c index e26832d3a..fa9fd2088 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -40,7 +40,7 @@ #include #include #include -#include /* stat (), getcwd (), getpagesize (), unlink () */ +#include /* stat (), getcwd (), getpagesize () */ #include #include @@ -1468,7 +1468,7 @@ tr_moveFile (const char * oldpath, const char * newpath, bool * renamed) if (bytesLeft != 0) return -1; - unlink (oldpath); + tr_remove (oldpath); return 0; } diff --git a/libtransmission/variant.c b/libtransmission/variant.c index 965302c9b..ced8cc062 100644 --- a/libtransmission/variant.c +++ b/libtransmission/variant.c @@ -23,7 +23,7 @@ #endif #include /* setlocale() */ -#include /* write(), unlink() */ +#include /* write() */ #include @@ -1206,7 +1206,7 @@ tr_variantToFile (const tr_variant * v, { tr_logAddError (_("Couldn't save temporary file \"%1$s\": %2$s"), tmp, tr_strerror (err)); tr_close_file (fd); - unlink (tmp); + tr_remove (tmp); } else { @@ -1220,7 +1220,7 @@ tr_variantToFile (const tr_variant * v, { err = errno; tr_logAddError (_("Couldn't save file \"%1$s\": %2$s"), filename, tr_strerror (err)); - unlink (tmp); + tr_remove (tmp); } } }