]> code.delx.au - gnu-emacs/blobdiff - src/tparam.c
Add a note how to use `tramp-own-remote-path'
[gnu-emacs] / src / tparam.c
index 538f26c83b6fbec75cec38f7bd78f097a805f046..d3ae4910b565c75fca7d3a36a9ac82e575c7e069 100644 (file)
@@ -1,5 +1,5 @@
 /* Merge parameters into a termcap entry string.
-   Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2015 Free
+   Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2016 Free
    Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
@@ -79,14 +79,14 @@ tparam1 (const char *string, char *outstring, int len,
   register int tem;
   int *old_argp = argp;                 /* can move */
   int *fixed_argp = argp;               /* never moves */
-  bool explicit_param_p = 0;            /* set by %p */
+  bool explicit_param_p = false;        /* set by %p */
   ptrdiff_t doleft = 0;
   ptrdiff_t doup = 0;
   ptrdiff_t append_len = 0;
 
   outend = outstring + len;
 
-  while (1)
+  while (true)
     {
       /* If the buffer might be too short, make it bigger.  */
       while (outend - op - append_len <= 5)
@@ -115,7 +115,7 @@ tparam1 (const char *string, char *outstring, int len,
        {
          c = *p++;
          if (explicit_param_p)
-           explicit_param_p = 0;
+           explicit_param_p = false;
          else
            tem = *argp;
          switch (c)
@@ -142,7 +142,7 @@ tparam1 (const char *string, char *outstring, int len,
              break;
             case 'p':           /* %pN means use param N for next subst.  */
              tem = fixed_argp[(*p++) - '1'];
-             explicit_param_p = 1;
+             explicit_param_p = true;
              break;
            case 'C':
              /* For c-100: print quotient of value by 96, if nonzero,
@@ -167,9 +167,9 @@ tparam1 (const char *string, char *outstring, int len,
                        doup++, append_len_incr = strlen (up);
                      else
                        doleft++, append_len_incr = strlen (left);
-                     if (INT_ADD_OVERFLOW (append_len, append_len_incr))
+                     if (INT_ADD_WRAPV (append_len_incr,
+                                        append_len, &append_len))
                        memory_full (SIZE_MAX);
-                     append_len += append_len_incr;
                    }
                }
              *op++ = tem ? tem : 0200;