Skip to content

Commit

Permalink
A couple of teeny tweaks (#3091)
Browse files Browse the repository at this point in the history
* Don't get HOMEDRIVE unless needed

* Use put_char instead of put_str
  • Loading branch information
petdance committed Apr 23, 2024
1 parent 6eff31a commit e4d0b12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/jv_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static void jv_dump_term(struct dtoa_context* C, jv x, int flags, int indent, FI
if (jv_get_kind(msg) == JV_KIND_STRING) {
put_str("<invalid:", F, S, flags & JV_PRINT_ISATTY);
jvp_dump_string(msg, flags | JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY);
put_str(">", F, S, flags & JV_PRINT_ISATTY);
put_char('>', F, S, flags & JV_PRINT_ISATTY);
} else {
put_str("<invalid>", F, S, flags & JV_PRINT_ISATTY);
}
Expand Down Expand Up @@ -259,7 +259,7 @@ static void jv_dump_term(struct dtoa_context* C, jv x, int flags, int indent, FI
put_str("[]", F, S, flags & JV_PRINT_ISATTY);
break;
}
put_str("[", F, S, flags & JV_PRINT_ISATTY);
put_char('[', F, S, flags & JV_PRINT_ISATTY);
jv_array_foreach(x, i, elem) {
if (i!=0) {
if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
Expand Down
4 changes: 2 additions & 2 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ jv get_home() {
#else
home = getenv("USERPROFILE");
if (!home) {
char *hd = getenv("HOMEDRIVE");
if (!hd) hd = "";
home = getenv("HOMEPATH");
if (!home) {
ret = jv_invalid_with_msg(jv_string("Could not find home directory."));
} else {
const char *hd = getenv("HOMEDRIVE");
if (!hd) hd = "";
ret = jv_string_fmt("%s%s",hd,home);
}
} else {
Expand Down

0 comments on commit e4d0b12

Please sign in to comment.