mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
buf: avoid 'new' as variable name
It's just good practice to avoid C++ keywords, in case someone someday wants to compile this code as C++.
This commit is contained in:
parent
7d2b5150e8
commit
1747d9e961
1 changed files with 8 additions and 8 deletions
|
|
@ -13,15 +13,15 @@
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue