diff --git a/examples/Squares.c b/examples/Squares.c index 3d1b45c..466ba61 100644 --- a/examples/Squares.c +++ b/examples/Squares.c @@ -2,42 +2,41 @@ #include int square(int x) { - return x*x; + return x*x; } #ifdef DEEPSTATE_TEST #include DeepState_EntryPoint(test_main) { - const char *new_args[2]; - new_args[0] = "deepstate"; - new_args[1] = DeepState_CStr(8); + const char *new_args[2]; + new_args[0] = "deepstate"; + new_args[1] = DeepState_CStr(8); - DeepState_Assert(0 == old_main(2, new_args)); + DeepState_Assert(0 == old_main(2, new_args)); } int main(int argc, const char *argv[]) { - return 0 == DeepState_Run(); + DeepState_InitOptions(argc, argv); + return 0 == DeepState_Run(); } -// yes this is awful but avoids another ifdef +// TODO(artem): yes this is awful but avoids another `ifdef`. #define main old_main #endif int main(int argc, char *argv[]) { - DeepState_InitOptions(argc, argv); + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + return -1; + } + int x = atoi(argv[1]); + int y = square(x); - if(argc != 2) { - printf("Usage: %s \n", argv[0]); - return -1; - } - int x = atoi(argv[1]); - int y = square(x); - - if(y + 4 == 29) { - printf("You found the secret number\n"); - return 0; - } else { - printf("Secret NOT found\n"); - return -1; - } + if (y + 4 == 29) { + printf("You found the secret number\n"); + return 0; + } else { + printf("Secret NOT found\n"); + return -1; + } } diff --git a/src/lib/Option.c b/src/lib/Option.c index 4c833d6..a458831 100644 --- a/src/lib/Option.c +++ b/src/lib/Option.c @@ -30,7 +30,7 @@ enum { static struct DeepState_Option *DeepState_Options = NULL; int DeepState_OptionsAreInitialized = 0; -static const char DeepState_FakeSpace = ' ' | 0x80; +static const char DeepState_FakeSpace = ' ' | ((char) 0x80); /* Copy of the option string. */ static int DeepState_OptionStringLength = 0;