diff --git a/src/calc.c b/src/calc.c index 1d877a5..ffc251f 100644 --- a/src/calc.c +++ b/src/calc.c @@ -30,7 +30,8 @@ char current_code_text[SMAX_LENGTH] = ""; char displayed_code[SMAX_LENGTH] = ""; // The result of execution -char result_text[RESULT_LENGTH] = ""; +#define RESULT_PREFIX "R:" +char result_text[RESULT_LENGTH] = RESULT_PREFIX; const char *tokens[] = { " ", "(", ")", @@ -207,7 +208,7 @@ static void calculate() char temp[RESULT_LENGTH-2] = ""; stringObj(temp, &obj); - snprintf(result_text, RESULT_LENGTH, "R:%s", temp); + snprintf(result_text, RESULT_LENGTH, RESULT_PREFIX "%s", temp); text_layer_set_text(s_result_text_layer, result_text); } @@ -277,7 +278,7 @@ static void code_window_load(Window *window) // Result text layer setup GRect result_bounds = GRect(6, 148, 132, 132); s_result_text_layer = text_layer_create(result_bounds); - text_layer_set_text(s_result_text_layer, "R: "); + text_layer_set_text(s_result_text_layer, result_text); text_layer_set_font(s_result_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); text_layer_set_text_alignment(s_result_text_layer, GTextAlignmentRight); layer_add_child(window_get_root_layer(s_code_window), text_layer_get_layer(s_result_text_layer)); @@ -422,7 +423,7 @@ static void custom_load(Window *window) window_stack_push(s_custom_window, true); } -Object add_window(Object obj1, Object obj2, struct Environment *env) +Object add_window(Object obj1, Object _, struct Environment *env) { printf("ADD_WINDOW\n"); if(obj1.type == TYPE_STRING) {