Declaring local functions as static.

This commit is contained in:
Murilo Pereira
2011-02-06 04:51:49 -02:00
parent 83df7ba92f
commit 8d1b2ca7b4
8 changed files with 31 additions and 44 deletions
+19 -19
View File
@@ -6,6 +6,25 @@
#include <errno.h>
#include "stack.h"
static bool maneuvre_stack(struct stack *stack) {
return(stack->card->frame->start_y >= MANEUVRE_STACKS_STARTING_Y);
}
static bool waste_pile_stack(struct stack *stack) {
return((stack->card->frame->start_x == WASTE_PILE_STARTING_X) &&
(stack->card->frame->start_y == WASTE_PILE_STARTING_Y));
}
static void refresh_card_coordinates(struct stack *origin, struct stack *destination) {
origin->card->frame->start_x = destination->card->frame->start_x;
origin->card->frame->start_y = destination->card->frame->start_y;
if (!empty(destination) && maneuvre_stack(destination)) {
origin->card->frame->start_y++;
}
return;
}
void allocate_stack(struct stack **stack) {
if (!(*stack = malloc(sizeof(**stack)))) {
fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1);
@@ -85,25 +104,6 @@ struct stack *pop(struct stack **stack) {
return(popped_entry);
}
bool maneuvre_stack(struct stack *stack) {
return(stack->card->frame->start_y >= MANEUVRE_STACKS_STARTING_Y);
}
bool waste_pile_stack(struct stack *stack) {
return((stack->card->frame->start_x == WASTE_PILE_STARTING_X) &&
(stack->card->frame->start_y == WASTE_PILE_STARTING_Y));
}
void refresh_card_coordinates(struct stack *origin, struct stack *destination) {
origin->card->frame->start_x = destination->card->frame->start_x;
origin->card->frame->start_y = destination->card->frame->start_y;
if (!empty(destination) && maneuvre_stack(destination)) {
origin->card->frame->start_y++;
}
return;
}
void move_card(struct stack **origin, struct stack **destination) {
struct stack *stack = NULL;