Browse Source

Get rid of tp->relpath.

master
Richard Nyberg 18 years ago
parent
commit
02733b16ec
3 changed files with 7 additions and 4 deletions
  1. +7
    -2
      btpd/tlib.c
  2. +0
    -1
      btpd/torrent.c
  3. +0
    -1
      btpd/torrent.h

+ 7
- 2
btpd/tlib.c View File

@@ -328,8 +328,10 @@ tlib_load_resume(struct tlib *tl, unsigned nfiles, struct file_time_size *fts,
{ {
int err, ver; int err, ver;
FILE *fp; FILE *fp;
char relpath[RELPATH_SIZE];
bin2hex(tl->hash, relpath, 20);


if ((err = vfopen(&fp, "r" , "torrents/%s/resume", tl->tp->relpath)) != 0)
if ((err = vfopen(&fp, "r" , "torrents/%s/resume", relpath)) != 0)
return err; return err;


if (fscanf(fp, "%d\n", &ver) != 1) if (fscanf(fp, "%d\n", &ver) != 1)
@@ -363,7 +365,10 @@ tlib_save_resume(struct tlib *tl, unsigned nfiles, struct file_time_size *fts,
{ {
int err; int err;
FILE *fp; FILE *fp;
if ((err = vfopen(&fp, "wb", "torrents/%s/resume", tl->tp->relpath)) != 0)
char relpath[RELPATH_SIZE];
bin2hex(tl->hash, relpath, 20);

if ((err = vfopen(&fp, "wb", "torrents/%s/resume", relpath)) != 0)
return; return;
fprintf(fp, "%d\n", 1); fprintf(fp, "%d\n", 1);
for (int i = 0; i < nfiles; i++) for (int i = 0; i < nfiles; i++)


+ 0
- 1
btpd/torrent.c View File

@@ -127,7 +127,6 @@ torrent_start(struct tlib *tl)


tp = btpd_calloc(1, sizeof(*tp)); tp = btpd_calloc(1, sizeof(*tp));
tp->tl = tl; tp->tl = tl;
bcopy(relpath, tp->relpath, RELPATH_SIZE);
tp->files = mi_files(mi); tp->files = mi_files(mi);
tp->nfiles = mi_nfiles(mi); tp->nfiles = mi_nfiles(mi);
if (tp->files == NULL) if (tp->files == NULL)


+ 0
- 1
btpd/torrent.h View File

@@ -14,7 +14,6 @@ enum torrent_state {
struct torrent { struct torrent {
struct tlib *tl; struct tlib *tl;


char relpath[RELPATH_SIZE];
enum torrent_state state; enum torrent_state state;
int delete; int delete;




Loading…
Cancel
Save