1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 18:18:10 +00:00

(trunk) prefer tr_remove() to unlink() or rmdir()

This commit is contained in:
Jordan Lee 2013-02-04 21:53:19 +00:00
parent 407c0b53c7
commit 445609f690
8 changed files with 12 additions and 16 deletions

View file

@ -17,7 +17,6 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <glib/gstdio.h> /* g_unlink () */
#include <gio/gio.h> /* g_file_trash () */ #include <gio/gio.h> /* g_file_trash () */
#include <libtransmission/transmission.h> /* TR_RATIO_NA, TR_RATIO_INF */ #include <libtransmission/transmission.h> /* TR_RATIO_NA, TR_RATIO_INF */

View file

@ -16,7 +16,7 @@
#include <stdlib.h> /* bsearch (), qsort () */ #include <stdlib.h> /* bsearch (), qsort () */
#include <string.h> #include <string.h>
#include <unistd.h> /* unlink () */ #include <unistd.h> /* close () */
#ifdef WIN32 #ifdef WIN32
#include <w32api.h> #include <w32api.h>
@ -139,7 +139,7 @@ static void
blocklistDelete (tr_blocklistFile * b) blocklistDelete (tr_blocklistFile * b)
{ {
blocklistClose (b); blocklistClose (b);
unlink (b->filename); tr_remove (b->filename);
} }
/*** /***

View file

@ -16,7 +16,7 @@
#include <string.h> /* strlen () */ #include <string.h> /* strlen () */
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> /* unlink, stat */ #include <unistd.h> /* stat */
#include <event2/buffer.h> #include <event2/buffer.h>
@ -587,7 +587,7 @@ tr_metainfoRemoveSaved (const tr_session * session, const tr_info * inf)
char * filename; char * filename;
filename = getTorrentFilename (session, inf); filename = getTorrentFilename (session, inf);
unlink (filename); tr_remove (filename);
tr_free (filename); tr_free (filename);
} }

View file

@ -10,8 +10,6 @@
* $Id$ * $Id$
*/ */
#include <unistd.h> /* unlink */
#include <string.h> #include <string.h>
#include "transmission.h" #include "transmission.h"
@ -923,6 +921,6 @@ void
tr_torrentRemoveResume (const tr_torrent * tor) tr_torrentRemoveResume (const tr_torrent * tor)
{ {
char * filename = getResumeFilename (tor); char * filename = getResumeFilename (tor);
unlink (filename); tr_remove (filename);
tr_free (filename); tr_free (filename);
} }

View file

@ -15,7 +15,6 @@
#include <errno.h> #include <errno.h>
#include <stdlib.h> /* strtol */ #include <stdlib.h> /* strtol */
#include <string.h> /* strcmp */ #include <string.h> /* strcmp */
#include <unistd.h> /* unlink */
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
#include <zlib.h> #include <zlib.h>
@ -1490,7 +1489,7 @@ gotNewBlocklist (tr_session * session,
tr_snprintf (result, sizeof (result), "success"); tr_snprintf (result, sizeof (result), "success");
} }
unlink (filename); tr_remove (filename);
tr_free (filename); tr_free (filename);
tr_free (buf); tr_free (buf);
} }

View file

@ -2921,7 +2921,7 @@ deleteLocalData (tr_torrent * tor, tr_fileFunc func)
removeEmptyFoldersAndJunkFiles (tr_ptrArrayNth (&folders, i)); removeEmptyFoldersAndJunkFiles (tr_ptrArrayNth (&folders, i));
/* cleanup */ /* cleanup */
rmdir (tmpdir); tr_remove (tmpdir);
tr_free (tmpdir); tr_free (tmpdir);
tr_ptrArrayDestruct (&folders, tr_free); tr_ptrArrayDestruct (&folders, tr_free);
tr_ptrArrayDestruct (&files, tr_free); tr_ptrArrayDestruct (&files, tr_free);

View file

@ -40,7 +40,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> /* stat (), getcwd (), getpagesize (), unlink () */ #include <unistd.h> /* stat (), getcwd (), getpagesize () */
#include <event2/buffer.h> #include <event2/buffer.h>
#include <event2/event.h> #include <event2/event.h>
@ -1468,7 +1468,7 @@ tr_moveFile (const char * oldpath, const char * newpath, bool * renamed)
if (bytesLeft != 0) if (bytesLeft != 0)
return -1; return -1;
unlink (oldpath); tr_remove (oldpath);
return 0; return 0;
} }

View file

@ -23,7 +23,7 @@
#endif #endif
#include <locale.h> /* setlocale() */ #include <locale.h> /* setlocale() */
#include <unistd.h> /* write(), unlink() */ #include <unistd.h> /* write() */
#include <event2/buffer.h> #include <event2/buffer.h>
@ -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_logAddError (_("Couldn't save temporary file \"%1$s\": %2$s"), tmp, tr_strerror (err));
tr_close_file (fd); tr_close_file (fd);
unlink (tmp); tr_remove (tmp);
} }
else else
{ {
@ -1220,7 +1220,7 @@ tr_variantToFile (const tr_variant * v,
{ {
err = errno; err = errno;
tr_logAddError (_("Couldn't save file \"%1$s\": %2$s"), filename, tr_strerror (err)); tr_logAddError (_("Couldn't save file \"%1$s\": %2$s"), filename, tr_strerror (err));
unlink (tmp); tr_remove (tmp);
} }
} }
} }