Browse Source

templ8/conf: Removed some redundant if conditions kek

Wazakindjes 4 months ago
parent
commit
d437a92450
1 changed files with 3 additions and 8 deletions
  1. 3 8
      templates/conf.c

+ 3 - 8
templates/conf.c

@@ -126,7 +126,7 @@ int MODNAME_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 		}
 
 		if(!strcmp(cep->ce_varname, "stringoption")) {
-			if(!cep->ce_vardata || !strlen(cep->ce_vardata)) {
+			if(!strlen(cep->ce_vardata)) {
 				config_error("%s:%i: %s::%s must be non-empty fam", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
 				errors++; // Increment err0r count fam
 			}
@@ -134,7 +134,7 @@ int MODNAME_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 		}
 
 		if(!strcmp(cep->ce_varname, "booloption")) {
-			if(!cep->ce_vardata || (strcmp(cep->ce_vardata, "0") && strcmp(cep->ce_vardata, "1"))) {
+			if(strcmp(cep->ce_vardata, "0") && strcmp(cep->ce_vardata, "1")) {
 				config_error("%s:%i: %s::%s must be either 0 or 1 fam", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
 				errors++; // Increment err0r count fam
 			}
@@ -143,7 +143,7 @@ int MODNAME_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 
 		if(!strcmp(cep->ce_varname, "timeoption")) {
 			// Should be a time string imo (7d10s etc, or just 20)
-			if(!cep->ce_vardata || config_checkval(cep->ce_vardata, CFG_TIME) <= 0) {
+			if(config_checkval(cep->ce_vardata, CFG_TIME) <= 0) {
 				config_error("%s:%i: %s::%s must be a time string like '7d10m' or simply '20'", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
 				errors++; // Increment err0r count fam
 			}
@@ -152,11 +152,6 @@ int MODNAME_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 
 		if(!strcmp(cep->ce_varname, "intoption")) {
 			// Should be an integer yo
-			if(!cep->ce_vardata) {
-				config_error("%s:%i: %s::%s must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
-				errors++; // Increment err0r count fam
-				continue;
-			}
 			for(i = 0; cep->ce_vardata[i]; i++) {
 				if(!isdigit(cep->ce_vardata[i])) {
 					config_error("%s:%i: %s::%s must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);