forked from NeoFlock/noom
initial commit
This commit is contained in:
22
src/helper.c
Normal file
22
src/helper.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "helper.h"
|
||||
#include "types.h"
|
||||
|
||||
int noom_startswith(const char* str, char* compare) {
|
||||
noom_uint_t i = 0;
|
||||
while (1) {
|
||||
if (compare[i] == '\0') return 1; // we did it
|
||||
if (str[i] != compare[i]) return 0;
|
||||
i++;
|
||||
}
|
||||
return 0; // unreachable but whatevs
|
||||
}
|
||||
|
||||
int noom_streql(const char* stra, noom_uint_t lena, const char* strb, noom_uint_t lenb) {
|
||||
if (lena != lenb) return 0;
|
||||
|
||||
for (noom_uint_t i = 0; i < lena; i++) {
|
||||
if (stra[i] != strb[i]) return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user