A few more simple changes & fixes.
authorWayne Davison <wayne@opencoder.net>
Fri, 26 Jun 2020 20:10:10 +0000 (13:10 -0700)
committerWayne Davison <wayne@opencoder.net>
Fri, 26 Jun 2020 20:19:07 +0000 (13:19 -0700)
ifuncs.h
options.c
rsync.1.md
rsync.h
util2.c

index 7f9bde09f74f9a799fe6cf3844e50f2fe1abc5cf..099fd07db9a8c3ba747e8a05aeabb30a9c770aa0 100644 (file)
--- 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;
 }
index 141fa24f7758a1d3d08b9fc9ddaee378209d546e..0e2c0bb0af0d856380d2f51778f3a09cad230fc7 100644 (file)
--- 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;
index e145efd05b841ca7f0c2564930d75c6b5ae957fe..f58cedfffa154c63923edacdb71394960ff94902 100644 (file)
@@ -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 ef2668d13e2fd936f5a274f48accfd92fa67948b..22a3a94964ecd61b00b6db01411bf5861bb0c4fa 100644 (file)
--- 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 10b7e4b6adb9b0a31e3733d0d0f92d39e7be229f..181dbd7d3424e7a31ff29cf35818ad5db2b9da0f 100644 (file)
--- 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)