summaryrefslogtreecommitdiffstats
path: root/src/opt.c
Commit message (Collapse)AuthorAgeFilesLines
* Default to no for "Do you want to continue?" promptsTavian Barnes2024-08-131-1/+1
|
* opt: Add a missing NULL check in lift_andor_not()Tavian Barnes2024-08-121-0/+4
| | | | | The annotation visitor probably can't fail, but we might as well check consistently.
* opt: Warn about ignored expressions after dangerous actionsTavian Barnes2024-08-121-12/+49
| | | | | | For example, `bfs -delete -type f` is almost certainly a mistake. Link: https://savannah.gnu.org/bugs/?65895
* opt: Copy data flow back up from the nested context in optimize()Tavian Barnes2024-08-121-2/+11
| | | | | | | | This fixes warnings on commands like `bfs -exclude -true` or `bfs -exclude -type f -type f`, because the data flow is properly shared between the -exclude expression and the main one. Fixes: 4a36bb9 ("expr: Make expressions variadic")
* prelude: Simplify attributesTavian Barnes2024-07-281-6/+6
|
* opt: -empty implies -type f,dTavian Barnes2024-07-171-5/+22
|
* opt: -lname implies -type lTavian Barnes2024-07-171-0/+7
|
* Minor formatting fixesTavian Barnes2024-06-061-21/+21
|
* Replace some switch-case lookups with arraysTavian Barnes2024-06-051-58/+25
|
* opt: Don't raise RLIMIT_NOFILE if it would prevent using posix_spawn()Tavian Barnes2024-05-231-0/+16
| | | | | | | | | | If we raise RLIMIT_NOFILE, we have to lower it before calling exec() for compatibility with select(). If posix_spawn() doesn't support that, we fall back to fork(), which is quite a bit slower. Therefore, if we're going to exec() on most files, it's better to keep RLIMIT_NOFILE the same to avoid the fork() cost, even though it makes bftw() somewhat slower.
* opt: true is true with probability 1, not 0Tavian Barnes2024-05-231-1/+1
|
* opt: Implement a general estimate_odds() functionTavian Barnes2024-05-231-9/+17
|
* expr: New for_expr macroTavian Barnes2024-05-231-6/+6
|
* opt: Add missing NULL check in visit_shallow()Tavian Barnes2024-04-241-1/+5
| | | | | visit_shallow() should propagate NULL, but look_up_visitor() dereferences expr to know which visitor to return.
* Rename config.h to prelude.hTavian Barnes2024-04-191-1/+1
|
* Fix some -Wpedantic warningsTavian Barnes2024-03-221-6/+6
|
* Implement -limit NTavian Barnes2024-03-201-0/+1
| | | | Closes: https://github.com/tavianator/bfs/issues/133
* Re-run include-what-you-useTavian Barnes2024-03-111-1/+2
|
* opt: Enable BFTW_STAT when profitableTavian Barnes2024-02-061-0/+91
|
* opt: Charge eval_flags() for a stat() callTavian Barnes2024-01-311-0/+1
|
* expr: Make expressions variadicTavian Barnes2024-01-071-777/+1593
| | | | | | | | | Rather than only unary/binary expressions, we now support an arbitrary number of children. The optimizer has been re-written almost completely and now supports optimal reordering of longer expression chains, rather than just arm-swapping. Fixes #85.
* expr: Arena-allocate expressionsTavian Barnes2023-12-201-73/+40
|
* opt: Use more standard terminology for data flow domainsTavian Barnes2023-12-201-298/+294
|
* config: s/attr_format/attr_printf/Tavian Barnes2023-12-181-2/+2
|
* config: New variadic attr(...) macroTavian Barnes2023-12-181-2/+2
|
* config: s/BFS_FORMATTER/attr_format/Tavian Barnes2023-11-091-2/+2
|
* Formatting fixesTavian Barnes2023-09-271-6/+5
|
* opt: Wait until purity is computed to update facts_when_impureTavian Barnes2023-06-161-4/+2
| | | | | | | | | | | Since we moved purity out of the parser, side-effect detection has been unnecessarily pessimistic due to this bug. The fix restores warnings in cases like $ bfs -false bfs: warning: This command won't do anything. Fixes: 693b5f60dc9787d9237920cc0c87fe0e010194ee
* Switch from assert() to bfs_assert()/bfs_verify()Tavian Barnes2023-05-181-7/+6
|
* config: Provide <stdalign.h> and <stdbool.h>Tavian Barnes2023-05-111-1/+0
| | | | In anticipation of C23, since those headers won't be necessary any more.
* config: s/BFS_COUNTOF/countof/Tavian Barnes2023-05-101-8/+8
|
* Replace license boilerplate with SPDX tagsTavian Barnes2023-01-251-15/+2
| | | | | | | And while I'm at it, remove years from copyright declarations. Link: https://spdx.dev/about/ Link: https://daniel.haxx.se/blog/2023/01/08/copyright-without-years/
* opt: Move probabilities out of the parserTavian Barnes2023-01-241-0/+132
|
* opt: Move costs out of the parserTavian Barnes2023-01-241-0/+54
|
* opt: Move always_{true,false} out of the parserTavian Barnes2023-01-241-0/+55
|
* opt: Move purity out of the parserTavian Barnes2023-01-241-0/+62
|
* opt: Use a table for simple range comparisonsTavian Barnes2023-01-241-14/+24
|
* opt: Use a table for simple predicatesTavian Barnes2023-01-241-17/+27
|
* opt: Use a table to look up optimizer functionsTavian Barnes2023-01-241-44/+71
|
* opt: Pass a va_list to bfs_vwarning(), not bfs_warning()Tavian Barnes2022-12-081-1/+1
| | | | Luckily none of the callers actually pass any arguments.
* expr: Rename bfs_expr_has_children() to _is_parent()Tavian Barnes2022-12-051-3/+3
|
* expr: Remove the singleton bfs_{true,false} expressionsTavian Barnes2022-11-301-31/+37
|
* expr: Remove the synthetic flagTavian Barnes2022-11-291-5/+0
| | | | | Only diagnostics cares about this, and we can just check if the pointers are equal.
* pwcache: Fill the user/group caches lazilyTavian Barnes2022-11-091-8/+11
| | | | | | | Iterating all the users/groups can be expensive, especially with NSS. Android has so many that it doesn't even return them all from get{pw,gr}ent() for performance reasons, leading to incorrect behaviour of -user/-group/etc.
* Fix includesTavian Barnes2022-11-061-2/+1
|
* bfstd: Rename from util and reorganize itTavian Barnes2022-11-061-1/+0
|
* Source / Include Folder (#88)トトも2022-04-161-0/+1088
Moved Source Files Into `src` Folder