#include <regex.h>
#include <ctype.h>
#include <string.h>
+#include <stdbool.h>
#include "shred.h"
/* control bits */
-static int remove_braces = 0;
-static int remove_whitespace = 0;
-static int remove_comments = 0;
+static bool remove_braces = false;
+static bool remove_whitespace = false;
+static bool remove_comments = false;
static char *c_patterns[] = {
/* Idioms that don't convey any meaning in isolation */
#include <sys/stat.h>
#include <errno.h>
#include <time.h>
+#include <stdbool.h>
#include "shred.h"
int verbose, debug, minsize, nofilter;
return(new);
}
-static int is_scf_file(const char *file)
+static bool is_scf_file(const char *file)
/* is the specified file an SCF hash list? */
{
char buf[BUFSIZ];
return(0);
}
fclose(fp);
- return(!strncmp(buf, "#SCF-A ", 7));
+ return(strncmp(buf, "#SCF-A ", 7) == 0);
}
/*
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
+#include <stdbool.h>
#include "shred.h"
#define min(x, y) ((x < y) ? (x) : (y))
return(1);
}
-static int sametree(const char *s, const char *t)
+static bool sametree(const char *s, const char *t)
/* are two files from the same tree? */
{
int sn = strchr(s, '/') - s;
#include <errno.h>
#include <ctype.h>
#include <stdlib.h>
+#include <stdbool.h>
#include "shred.h"
/* control bits, meant to be set at startup */
#define MIN_PRINTABLE 0.9
-static int eligible(const char *file)
+static bool eligible(const char *file)
/* is the specified file eligible to be compared? */
{
#define endswith(suff) !strcmp(suff, file + strlen(file) - strlen(suff))
if (strstr(file, "CVS") || strstr(file,"RCS") || strstr(file,"SCCS") || strstr(file, "SVN") || endswith(".svn") || endswith(".git") || endswith(".hg") || endswith(".bzr"))
- return(0);
+ return(false);
/* fast check for the most common suffixes */
else if (endswith(".c") || endswith(".h") || endswith(".html"))
- return(1);
+ return(true);
else if (endswith(".o") || endswith("~") || endswith(".bdf"))
- return(0);
+ return(false);
#undef endswith
else
{