]> git.mdlowis.com Git - proto/labwc.git/commitdiff
buf: avoid 'new' as variable name
authorJohn Lindgren <john@jlindgren.net>
Fri, 4 Jul 2025 04:17:18 +0000 (00:17 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 21 Jul 2025 14:51:10 +0000 (16:51 +0200)
It's just good practice to avoid C++ keywords, in case someone
someday wants to compile this code as C++.

src/common/buf.c

index 1e103fae22395eccb224b345b38a106553898c6f..0fe810fc725f2a70c9dc6285fe41ea2e74daf23a 100644 (file)
 void
 buf_expand_tilde(struct buf *s)
 {
-       struct buf new = BUF_INIT;
+       struct buf tmp = BUF_INIT;
        for (int i = 0 ; i < s->len ; i++) {
                if (s->data[i] == '~') {
-                       buf_add(&new, getenv("HOME"));
+                       buf_add(&tmp, getenv("HOME"));
                } else {
-                       buf_add_char(&new, s->data[i]);
+                       buf_add_char(&tmp, s->data[i]);
                }
        }
-       buf_move(s, &new);
+       buf_move(s, &tmp);
 }
 
 static void
@@ -45,7 +45,7 @@ isvalid(char p)
 void
 buf_expand_shell_variables(struct buf *s)
 {
-       struct buf new = BUF_INIT;
+       struct buf tmp = BUF_INIT;
        struct buf environment_variable = BUF_INIT;
 
        for (int i = 0 ; i < s->len ; i++) {
@@ -62,14 +62,14 @@ buf_expand_shell_variables(struct buf *s)
                        strip_curly_braces(environment_variable.data);
                        p = getenv(environment_variable.data);
                        if (p) {
-                               buf_add(&new, p);
+                               buf_add(&tmp, p);
                        }
                } else {
-                       buf_add_char(&new, s->data[i]);
+                       buf_add_char(&tmp, s->data[i]);
                }
        }
        buf_reset(&environment_variable);
-       buf_move(s, &new);
+       buf_move(s, &tmp);
 }
 
 static void