diff options
| author | Filip Wandzio <contact@philw.dev> | 2026-03-01 17:47:44 +0100 |
|---|---|---|
| committer | Filip Wandzio <contact@philw.dev> | 2026-03-01 17:47:44 +0100 |
| commit | 5e9480f817e08dc0eddaee23321effb24012120d (patch) | |
| tree | 196d13fbcd19786108a51d75d5f99078ceba574a /include | |
| parent | bf0d77d7d448e964e9716d5af67c48f3d014f090 (diff) | |
| download | embedded_guardian-5e9480f817e08dc0eddaee23321effb24012120d.tar.gz embedded_guardian-5e9480f817e08dc0eddaee23321effb24012120d.zip | |
Reformat code like a sane person
Signed-off-by: Filip Wandzio <contact@philw.dev>
Diffstat (limited to '')
| -rw-r--r-- | include/syntax_essentials.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/syntax_essentials.h b/include/syntax_essentials.h index 181cb99..2327636 100644 --- a/include/syntax_essentials.h +++ b/include/syntax_essentials.h | |||
| @@ -2,6 +2,20 @@ | |||
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * | 4 | * |
| 5 | * TASK 0: result codes | ||
| 6 | * -------------------- | ||
| 7 | * Idiomatic named return codes instead of raw numbers. | ||
| 8 | */ | ||
| 9 | typedef enum { | ||
| 10 | RESULT_VALID = 0, | ||
| 11 | RESULT_INVALID_NAME = 1, | ||
| 12 | RESULT_INVALID_INDEX = 2, | ||
| 13 | RESULT_ARRAY_FULL = 3, | ||
| 14 | RESULT_NULL_POINTER = 4 | ||
| 15 | } Result; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * | ||
| 5 | * TASK 1: validate_first_name | 19 | * TASK 1: validate_first_name |
| 6 | * --------------------------- | 20 | * --------------------------- |
| 7 | * Check if the first name is valid. | 21 | * Check if the first name is valid. |
| @@ -70,7 +84,7 @@ typedef struct { | |||
| 70 | * ------------------- | 84 | * ------------------- |
| 71 | * Add a student to an array of Student. Return 0 if added. | 85 | * Add a student to an array of Student. Return 0 if added. |
| 72 | */ | 86 | */ |
| 73 | int add_student(Student *array, int max_size, const char *name, | 87 | int add_student(Student *array, int max_length, const char *name, |
| 74 | const char *index); | 88 | const char *index); |
| 75 | 89 | ||
| 76 | /** | 90 | /** |
| @@ -78,4 +92,4 @@ int add_student(Student *array, int max_size, const char *name, | |||
| 78 | * ------------------------ | 92 | * ------------------------ |
| 79 | * Return error message string for code returned by register_student | 93 | * Return error message string for code returned by register_student |
| 80 | */ | 94 | */ |
| 81 | const char *get_error_message(int code); | 95 | const char *get_error_message(int code); \ No newline at end of file |
