Added limit function...
This commit is contained in:
parent
1d9f128c1d
commit
4f7de650a5
10
xtandard.c
10
xtandard.c
@ -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;
|
||||
|
||||
|
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user