File: gstats.c

package info (click to toggle)
rdiff-backup-fs 1.0.0-8
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 952 kB
  • sloc: sh: 3,800; ansic: 2,944; makefile: 23
file content (24 lines) | stat: -rw-r--r-- 894 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "gstats.h"
#include "gstring.h"
#include "gutils.h"

void copy_stats(stats_t *source, stats_t **dest){
    debug(3, "copying stats for: path %s, internal: %s, name: %s, rev: %d\n",
          source->path, source->internal, source->name, source->rev);
    *dest = single(stats_t);
    memcpy((*dest), source, sizeof(stats_t));
    if (source->path){
        (*dest)->path = 0;
        gstrcpy(&(*dest)->path, source->path);
    }
    if (source->internal)
        (*dest)->internal = (*dest)->path + (source->internal - source->path);
    if (source->name)
        (*dest)->name = (*dest)->path + (source->name - source->path);
    if (source->link) {
        (*dest)->link = 0;
        gstrcpy(&(*dest)->link, source->link);
    }
    debug(4, "done copying stats: path %s, internal %s, name %s, rev: %d\n",
          (*dest)->path, (*dest)->internal, (*dest)->name, (*dest)->rev);
};