mirror of
https://github.com/upa/mscp.git
synced 2026-02-19 21:24:46 +08:00
remove unnecessary code lines
This commit is contained in:
@@ -50,8 +50,6 @@ int bwlimit_init(struct bwlimit *bw, uint64_t bps, uint64_t win)
|
|||||||
#define timespeccmp(a, b, expr) \
|
#define timespeccmp(a, b, expr) \
|
||||||
((a.tv_sec * 1000000000 + a.tv_nsec) expr(b.tv_sec * 1000000000 + b.tv_nsec))
|
((a.tv_sec * 1000000000 + a.tv_nsec) expr(b.tv_sec * 1000000000 + b.tv_nsec))
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int bwlimit_wait(struct bwlimit *bw, size_t nr_bytes)
|
int bwlimit_wait(struct bwlimit *bw, size_t nr_bytes)
|
||||||
{
|
{
|
||||||
struct timespec now, end, rq, rm;
|
struct timespec now, end, rq, rm;
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ MDIR *mscp_opendir_wrapped(const char *path)
|
|||||||
|
|
||||||
void mscp_closedir(MDIR *md)
|
void mscp_closedir(MDIR *md)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
if (md->remote)
|
if (md->remote)
|
||||||
sftp_closedir(md->remote);
|
sftp_closedir(md->remote);
|
||||||
else
|
else
|
||||||
|
|||||||
11
src/main.c
11
src/main.c
@@ -117,8 +117,6 @@ char *split_user_host_path(const char *s, char **userp, char **hostp, char **pat
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
user = NULL;
|
|
||||||
host = NULL;
|
|
||||||
path = tmp;
|
path = tmp;
|
||||||
for (cp = tmp; *cp; cp++) {
|
for (cp = tmp; *cp; cp++) {
|
||||||
if (*cp == '@' && (cp > tmp) && *(cp - 1) != '\\' && user == NULL) {
|
if (*cp == '@' && (cp > tmp) && *(cp - 1) != '\\' && user == NULL) {
|
||||||
@@ -211,7 +209,6 @@ struct target *validate_targets(char **arg, int len)
|
|||||||
pr_err("calloc: %s", strerrno());
|
pr_err("calloc: %s", strerrno());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(t, 0, len * sizeof(struct target));
|
|
||||||
|
|
||||||
/* split remote:path into remote and path */
|
/* split remote:path into remote and path */
|
||||||
for (n = 0; n < len; n++) {
|
for (n = 0; n < len; n++) {
|
||||||
@@ -309,7 +306,7 @@ long atol_with_unit(char *value, bool i)
|
|||||||
{
|
{
|
||||||
/* value must be "\d+[kKmMgG]?" */
|
/* value must be "\d+[kKmMgG]?" */
|
||||||
|
|
||||||
char *u = value + (strlen(optarg) - 1);
|
char *u = value + (strlen(value) - 1);
|
||||||
long k = i ? 1024 : 1000;
|
long k = i ? 1024 : 1000;
|
||||||
long factor = 1;
|
long factor = 1;
|
||||||
long v;
|
long v;
|
||||||
@@ -359,7 +356,6 @@ int main(int argc, char **argv)
|
|||||||
struct mscp_ssh_opts s;
|
struct mscp_ssh_opts s;
|
||||||
struct mscp_opts o;
|
struct mscp_opts o;
|
||||||
struct target *t;
|
struct target *t;
|
||||||
int pipe_fd[2];
|
|
||||||
int ch, n, i, ret;
|
int ch, n, i, ret;
|
||||||
int direction = 0;
|
int direction = 0;
|
||||||
char *remote = NULL, *checkpoint_save = NULL, *checkpoint_load = NULL;
|
char *remote = NULL, *checkpoint_save = NULL, *checkpoint_load = NULL;
|
||||||
@@ -776,8 +772,6 @@ struct xfer_stat x;
|
|||||||
void print_stat(bool final)
|
void print_stat(bool final)
|
||||||
{
|
{
|
||||||
struct mscp_stats s;
|
struct mscp_stats s;
|
||||||
char buf[8192];
|
|
||||||
int timeout;
|
|
||||||
|
|
||||||
gettimeofday(&x.after, NULL);
|
gettimeofday(&x.after, NULL);
|
||||||
if (calculate_timedelta(&x.before, &x.after) > 1 || final) {
|
if (calculate_timedelta(&x.before, &x.after) > 1 || final) {
|
||||||
@@ -793,9 +787,6 @@ void print_stat(bool final)
|
|||||||
|
|
||||||
void *print_stat_thread(void *arg)
|
void *print_stat_thread(void *arg)
|
||||||
{
|
{
|
||||||
struct mscp_stats s;
|
|
||||||
char buf[8192];
|
|
||||||
|
|
||||||
memset(&x, 0, sizeof(x));
|
memset(&x, 0, sizeof(x));
|
||||||
gettimeofday(&x.start, NULL);
|
gettimeofday(&x.start, NULL);
|
||||||
x.before = x.start;
|
x.before = x.start;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ struct mscp {
|
|||||||
|
|
||||||
static int expand_coremask(const char *coremask, int **cores, int *nr_cores)
|
static int expand_coremask(const char *coremask, int **cores, int *nr_cores)
|
||||||
{
|
{
|
||||||
int n, *core_list, core_list_len = 0, nr_usable, nr_all;
|
int n, *core_list, nr_usable, nr_all;
|
||||||
char c[2] = { 'x', '\0' };
|
char c[2] = { 'x', '\0' };
|
||||||
const char *_coremask;
|
const char *_coremask;
|
||||||
long v, needle;
|
long v, needle;
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ void set_print_severity(int serverity)
|
|||||||
{
|
{
|
||||||
if (serverity < 0)
|
if (serverity < 0)
|
||||||
__print_severity = -1; /* no print */
|
__print_severity = -1; /* no print */
|
||||||
__print_severity = serverity;
|
else
|
||||||
|
__print_severity = serverity;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_print_severity()
|
int get_print_severity()
|
||||||
|
|||||||
Reference in New Issue
Block a user