Skip to content

Commit

Permalink
#164 consistency in brief formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-courtis committed Dec 22, 2024
1 parent bc7faae commit 0ae9f29
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bool mkdir_p(char *path, mode_t mode) {
}

bool file_write(const char *path, const char *contents, const char *mode) {
if (!path) {
if (!path || !mode) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ char *brief_delta_mode(const enum ConfigState config_state, const struct Head *
char *buf = (char*)calloc(LEN_BRIEF, sizeof(char));
char *bufp = buf;

bufp += snprintf(bufp, LEN_BRIEF - (bufp - buf), "%s:\n ",
bufp += snprintf(bufp, LEN_BRIEF - (bufp - buf), "%s\n ",
head->description ? head->description : head->name
);

Expand Down Expand Up @@ -547,7 +547,7 @@ char *brief_delta_adaptive_sync(const enum ConfigState config_state, const struc
char *buf = (char*)calloc(LEN_BRIEF, sizeof(char));
char *bufp = buf;

bufp += snprintf(bufp, LEN_BRIEF - (bufp - buf), "%s:\n VRR %s",
bufp += snprintf(bufp, LEN_BRIEF - (bufp - buf), "%s\n VRR %s",
head->description ? head->description : head->name,
head->desired.adaptive_sync == ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED ? "on" : "off"
);
Expand Down
8 changes: 4 additions & 4 deletions tst/tst-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void brief_delta_mode__to_no(void **state) {
char *deltas = brief_delta_mode(SUCCEEDED, s->head1);

assert_string_equal(deltas, ""
"description1:\n"
"description1\n"
" 100x200@30Hz -> (no mode)"
);

Expand All @@ -283,7 +283,7 @@ void brief_delta_mode__from_no(void **state) {
char *deltas = brief_delta_mode(SUCCEEDED, s->head2);

assert_string_equal(deltas, ""
"name2:\n"
"name2\n"
" (no mode) -> 1400x1500@160Hz"
);

Expand All @@ -301,7 +301,7 @@ void brief_delta_adaptive_sync__on(void **state) {
char *deltas = brief_delta_adaptive_sync(SUCCEEDED, s->head1);

assert_string_equal(deltas, ""
"description1:\n"
"description1\n"
" VRR on"
);

Expand All @@ -319,7 +319,7 @@ void brief_delta_adaptive_sync__off(void **state) {
char *deltas = brief_delta_adaptive_sync(SUCCEEDED, s->head2);

assert_string_equal(deltas, ""
"name2:\n"
"name2\n"
" VRR off"
);

Expand Down

0 comments on commit 0ae9f29

Please sign in to comment.