Added limit function...

This commit is contained in:
Ognjen Milan Robovic 2023-09-20 07:45:17 -04:00
parent 1d9f128c1d
commit 4f7de650a5
2 changed files with 12 additions and 0 deletions

View File

@ -67,6 +67,16 @@ void fatal_failure (int condition, char * message) {
}
}
void limit (int * value, int minimum, int maximum) {
if (* value <= minimum) {
* value = minimum;
}
if (* value >= maximum) {
* value = maximum;
}
}
void * allocate (int size) {
char * data = NULL;

View File

@ -80,6 +80,8 @@ extern void echo_byte (int);
extern void fatal_failure (int, char *);
extern void limit (int *, int, int);
extern void * allocate (int);
extern void * reallocate (void *, int);
extern void * deallocate (void *);