1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +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 <glib/gi18n.h>
#include <glib/gstdio.h> /* g_unlink () */
#include <gio/gio.h> /* g_file_trash () */
#include <libtransmission/transmission.h> /* TR_RATIO_NA, TR_RATIO_INF */

View file

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

View file

@ -16,7 +16,7 @@
#include <string.h> /* strlen () */
#include <sys/types.h>
#include <unistd.h> /* unlink, stat */
#include <unistd.h> /* stat */
#include <event2/buffer.h>
@ -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);
}

View file

@ -10,8 +10,6 @@
* $Id$
*/
#include <unistd.h> /* unlink */
#include <string.h>
#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);
}

View file

@ -15,7 +15,6 @@
#include <errno.h>
#include <stdlib.h> /* strtol */
#include <string.h> /* strcmp */
#include <unistd.h> /* unlink */
#ifdef HAVE_ZLIB
#include <zlib.h>
@ -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);
}

View file

@ -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);

View file

@ -40,7 +40,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h> /* stat (), getcwd (), getpagesize (), unlink () */
#include <unistd.h> /* stat (), getcwd (), getpagesize () */
#include <event2/buffer.h>
#include <event2/event.h>
@ -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;
}

View file

@ -23,7 +23,7 @@
#endif
#include <locale.h> /* setlocale() */
#include <unistd.h> /* write(), unlink() */
#include <unistd.h> /* write() */
#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_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);
}
}
}