summaryrefslogtreecommitdiff
path: root/src/stack.c
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2025-04-14 23:22:57 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2025-04-14 23:22:57 +0200
commitb3bd068f614a46580ee3e5688dd9cfd40694d75b (patch)
tree45183f99a8373527caa03ff473c4e40fe07cd459 /src/stack.c
parent63104d34e1c1772131f6366f825e67f38d027dba (diff)
Define clang-format and .editorconfig settingsHEADmaster
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'src/stack.c')
-rw-r--r--src/stack.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/stack.c b/src/stack.c
index 5121f6b..c83b429 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -14,24 +14,25 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <stdio.h>
#include "stack.h"
+#include <stdio.h>
-void stack_push(stack_t *stack, int value)
+void
+stack_push(stack_t* stack, int value)
{
- if (stack->size >= stack->capacity) {
- perror("stack overflow");
- exit(EXIT_FAILURE);
- }
- stack->data[stack->size++] = value;
+ if (stack->size >= stack->capacity) {
+ perror("stack overflow");
+ exit(EXIT_FAILURE);
+ }
+ stack->data[stack->size++] = value;
}
-int stack_pop(stack_t *stack)
+int
+stack_pop(stack_t* stack)
{
- if (stack->size <= 0) {
- perror("stack_pop: Stack already empty");
- exit(EXIT_FAILURE);
- }
- return stack->data[--stack->size];
+ if (stack->size <= 0) {
+ perror("stack_pop: Stack already empty");
+ exit(EXIT_FAILURE);
+ }
+ return stack->data[--stack->size];
}
-