Skip to content

Commit

Permalink
Rename macros
Browse files Browse the repository at this point in the history
  • Loading branch information
sasha0552 authored Aug 18, 2024
1 parent 10364e8 commit 1eafdf5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,31 +122,31 @@ int main(int argc, char *argv[]) {
// Check if the option is "-ibs" or "--iterations-before-switch" and if there is a next argument
if ((IS_OPTION("-ibs") || IS_OPTION("--iterations-before-switch")) && HAS_NEXT_ARG) {
// Parse the integer option and store it in iterations_before_switch
IS_TRUE(parse_uint(argv[++i], &iterations_before_switch), usage);
ASSERT_TRUE(parse_uint(argv[++i], &iterations_before_switch), usage);
}

// Check if the option is "-psh" or "--performance-state-high" and if there is a next argument
if ((IS_OPTION("-psh") || IS_OPTION("--performance-state-high")) && HAS_NEXT_ARG) {
// Parse the integer option and store it in performance_state_high
IS_TRUE(parse_uint(argv[++i], &performance_state_high), usage);
ASSERT_TRUE(parse_uint(argv[++i], &performance_state_high), usage);
}

// Check if the option is "-psl" or "--performance-state-low" and if there is a next argument
if ((IS_OPTION("-psl") || IS_OPTION("--performance-state-low")) && HAS_NEXT_ARG) {
// Parse the integer option and store it in performance_state_low
IS_TRUE(parse_uint(argv[++i], &performance_state_low), usage);
ASSERT_TRUE(parse_uint(argv[++i], &performance_state_low), usage);
}

// Check if the option is "-si" or "--sleep-interval" and if there is a next argument
if ((IS_OPTION("-si") || IS_OPTION("--sleep-interval")) && HAS_NEXT_ARG) {
// Parse the integer option and store it in sleep_interval
IS_TRUE(parse_uint(argv[++i], &sleep_interval), usage);
ASSERT_TRUE(parse_uint(argv[++i], &sleep_interval), usage);
}

// Check if the option is "-tt" or "--temperature-threshold" and if there is a next argument
if ((IS_OPTION("-tt") || IS_OPTION("--temperature-threshold")) && HAS_NEXT_ARG) {
// Parse the integer option and store it in temperature_threshold
IS_TRUE(parse_uint(argv[++i], &temperature_threshold), usage);
ASSERT_TRUE(parse_uint(argv[++i], &temperature_threshold), usage);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define HAS_NEXT_ARG (i + 1 < argc)

// Macro to check if a condition is true and jump to a label if it is not
#define IS_TRUE(call, label) do { \
#define ASSERT_TRUE(call, label) do { \
/* Evaluate the condition */ \
int result = (call); \
\
Expand All @@ -39,7 +39,7 @@
} while(0);

// Macro to check if a condition is false and jump to a label if it is not
#define IS_FALSE(call, label) do { \
#define ASSERT_FALSE(call, label) do { \
/* Evaluate the condition */ \
int result = (call); \
\
Expand Down

0 comments on commit 1eafdf5

Please sign in to comment.