Compare commits
7 Commits
dea9ea660e
...
3a1e87fa24
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3a1e87fa24 | ||
![]() |
d5710a0b14 | ||
![]() |
f287f0952e | ||
![]() |
6f61da04ff | ||
![]() |
a46cabebdf | ||
![]() |
81310b9d79 | ||
![]() |
60427b7841 |
@ -40,7 +40,6 @@ int main() {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Strip out any whitespaces
|
||||
char* dst = input;
|
||||
for(char * src = input; *src; src++) {
|
||||
if(!isspace(*src)) {
|
||||
@ -50,10 +49,6 @@ int main() {
|
||||
*dst = '\0';
|
||||
|
||||
int trimmed_len = strlen(input);
|
||||
|
||||
// Check whether the provided input
|
||||
// starts with rgb(
|
||||
// and ends with )
|
||||
if(strncmp(input, "rgb(", 4) != 0 || input[trimmed_len - 1] != ')') {
|
||||
debug("%s not in rgb(xxx) format", input);
|
||||
return invalid_input();
|
||||
@ -65,13 +60,10 @@ int main() {
|
||||
char* token = strtok(slice, ",");
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
// strtok reached end prematurely
|
||||
if(token == NULL) {
|
||||
debug("Too few numbers");
|
||||
return invalid_input();
|
||||
}
|
||||
|
||||
// Not a number
|
||||
if(!is_numeric(token)) {
|
||||
debug("%s is not a number", token);
|
||||
return invalid_input();
|
||||
|
Loading…
x
Reference in New Issue
Block a user