Skip to content

Commit

Permalink
I'm tired of looking at all these one-line ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreer committed Feb 9, 2013
1 parent 3f7e1c3 commit 09451e5
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/main.c
Expand Up @@ -46,34 +46,27 @@ int main(int argc, char **argv) {
log_debug("PCRE Version: %s", pcre_version());

workers_len = (int)sysconf(_SC_NPROCESSORS_ONLN);
if (opts.literal) {
if (opts.literal)
workers_len--;
}
if (opts.workers) {
if (opts.workers)
workers_len = opts.workers;
}
if (workers_len < 1) {
if (workers_len < 1)
workers_len = 1;
}

log_debug("Using %i workers", workers_len);
done_adding_files = FALSE;
workers = ag_calloc(workers_len, sizeof(pthread_t));
if (pthread_cond_init(&files_ready, NULL)) {
if (pthread_cond_init(&files_ready, NULL))
die("pthread_cond_init failed!");
}
if (pthread_mutex_init(&print_mtx, NULL)) {
if (pthread_mutex_init(&print_mtx, NULL))
die("pthread_mutex_init failed!");
}
if (pthread_mutex_init(&stats_mtx, NULL)) {
if (pthread_mutex_init(&stats_mtx, NULL))
die("pthread_mutex_init failed!");
}
if (pthread_mutex_init(&work_queue_mtx, NULL)) {
if (pthread_mutex_init(&work_queue_mtx, NULL))
die("pthread_mutex_init failed!");
}

if (opts.casing == CASE_SMART) {
if (opts.casing == CASE_SMART)
opts.casing = is_lowercase(opts.query) ? CASE_INSENSITIVE : CASE_SENSITIVE;
}

if (opts.literal) {
if (opts.casing == CASE_INSENSITIVE) {
Expand Down

0 comments on commit 09451e5

Please sign in to comment.