aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-17 21:15:37 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-17 21:15:37 -0800
commit1110a0ce8b3c9732f14f81e81e0e3bc7a0a6ddda (patch)
treec69e28296350846128f1950aec0bca6080d58158
parent33665fe9935b0fb9d09f03d92e122e2c9be46508 (diff)
Fixed bug with NULL filename
-rw-r--r--bp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bp.c b/bp.c
index 65150c2..6abd29b 100644
--- a/bp.c
+++ b/bp.c
@@ -348,6 +348,7 @@ static int print_matches(def_t *defs, file_t *f, pat_t *pattern)
// For a given filename, open the file and attempt to match the given pattern
// against it, printing any results according to the flags.
//
+__attribute__((nonnull(2,3)))
static int process_file(def_t *defs, const char *filename, pat_t *pattern)
{
file_t *f = load_file(NULL, filename);
@@ -385,6 +386,7 @@ static int process_file(def_t *defs, const char *filename, pat_t *pattern)
//
// Recursively process all non-dotfile files in the given directory.
//
+__attribute__((nonnull(2,3)))
static int process_dir(def_t *defs, const char *dirname, pat_t *pattern)
{
int matches = 0;
@@ -606,7 +608,7 @@ int main(int argc, char *argv[])
found += process_dir(defs, ".", pattern);
} else {
// Piped in input:
- found += process_file(defs, NULL, pattern);
+ found += process_file(defs, "", pattern);
}
if (mode == MODE_JSON) printf("]\n");