From d07c2992d1b672ac8524e462fcb5f4bf223de768 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 26 Jun 2020 13:10:10 -0700 Subject: [PATCH] A few more simple changes & fixes. --- ifuncs.h | 2 +- options.c | 2 +- rsync.1.md | 2 +- rsync.h | 12 ++++++------ util2.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ifuncs.h b/ifuncs.h index 7f9bde09..099fd07d 100644 --- a/ifuncs.h +++ b/ifuncs.h @@ -105,7 +105,7 @@ free_stat_x(stat_x *sx_p) static inline char *my_strdup(const char *str, const char *file, int line) { int len = strlen(str)+1; - char *buf = _my_alloc(do_malloc, len, 1, file, line); + char *buf = my_alloc(do_malloc, len, 1, file, line); memcpy(buf, str, len); return buf; } diff --git a/options.c b/options.c index 141fa24f..0e2c0bb0 100644 --- a/options.c +++ b/options.c @@ -1301,7 +1301,7 @@ static ssize_t parse_size_arg(char *size_arg, char def_suf, const char *opt_name while (reps--) size *= mult; size *= atof(size_arg); - if ((*arg == '+' || *arg == '-') && arg[1] == '1') + if ((*arg == '+' || *arg == '-') && arg[1] == '1' && arg != size_arg) size += atoi(arg), arg += 2; if (*arg) goto failure; diff --git a/rsync.1.md b/rsync.1.md index e145efd0..f58cedff 100644 --- a/rsync.1.md +++ b/rsync.1.md @@ -1740,7 +1740,7 @@ your home directory (remove the '=' for that). multiples of 1024. If you use a two-letter suffix that ends with a "B" (e.g. "kb") then you get units that are multiples of 1000. - Finally, if the value ends with either "+1" or "-1", it will be offset by + Finally, if the string ends with either "+1" or "-1", it will be offset by one byte in the indicated direction. The largest possible value is `8192P-1`. diff --git a/rsync.h b/rsync.h index ef2668d1..22a3a949 100644 --- a/rsync.h +++ b/rsync.h @@ -1265,13 +1265,13 @@ extern int errno; extern char *do_malloc; /* Convenient wrappers for malloc and realloc. Use them. */ -#define new(type) ((type*)_my_alloc(do_malloc, 1, sizeof (type), __FILE__, __LINE__)) -#define new0(type) ((type*)_my_alloc(NULL, 1, sizeof (type), __FILE__, __LINE__)) -#define realloc_buf(ptr, num) _my_alloc((ptr), (num), 1, __FILE__, __LINE__) +#define new(type) ((type*)my_alloc(do_malloc, sizeof (type), 1, __FILE__, __LINE__)) +#define new0(type) ((type*)my_alloc(NULL, sizeof (type), 1, __FILE__, __LINE__)) +#define realloc_buf(ptr, num) my_alloc((ptr), (num), 1, __FILE__, __LINE__) -#define new_array(type, num) ((type*)_my_alloc(do_malloc, (num), sizeof (type), __FILE__, __LINE__)) -#define new_array0(type, num) ((type*)_my_alloc(NULL, (num), sizeof (type), __FILE__, __LINE__)) -#define realloc_array(ptr, type, num) ((type*)_my_alloc((ptr), (num), sizeof (type), __FILE__, __LINE__)) +#define new_array(type, num) ((type*)my_alloc(do_malloc, (num), sizeof (type), __FILE__, __LINE__)) +#define new_array0(type, num) ((type*)my_alloc(NULL, (num), sizeof (type), __FILE__, __LINE__)) +#define realloc_array(ptr, type, num) ((type*)my_alloc((ptr), (num), sizeof (type), __FILE__, __LINE__)) #define strdup(s) my_strdup(s, __FILE__, __LINE__) diff --git a/util2.c b/util2.c index 10b7e4b6..181dbd7d 100644 --- a/util2.c +++ b/util2.c @@ -71,7 +71,7 @@ int msleep(int t) return True; } -/* We convert a num manually because need %lld precision, and that's not a portable sprintf() escape. */ +/* Convert a num manually because the needed %lld precision is not a portable sprintf() escape. */ char *num_to_byte_string(ssize_t num) { char buf[128], *s = buf + sizeof buf - 1; @@ -84,7 +84,7 @@ char *num_to_byte_string(ssize_t num) return strdup(s); } -void *_my_alloc(void *ptr, size_t num, size_t size, const char *file, int line) +void *my_alloc(void *ptr, size_t num, size_t size, const char *file, int line) { if (num >= max_alloc/size) { if (!file) -- 2.47.2