Added non-TRACE info messages on needle+haystack un/mappings

Fortune for naka's current commit: Future small blessing − 末小吉
master
Avril 3 years ago
parent d82407951a
commit d9eed51762
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -68,6 +68,9 @@
#define LIKELY(x) __builtin_expect(!!(x), 1)
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
#define ifL(x) if(LIKELY((x)))
#define ifU(x) if(UNLIKELY((x)))
/// Equivalent to GNU C `x ?: y` operator.
#define TERN_OR(x, y) ({ let _x = (x); _x ? _x : (y); })
@ -75,7 +78,7 @@
#define _no_op ((void)0)
#define IGNORE(x) ((void)(x))
_mixin void _drain_val(void* x, ...) { IGNORE(x); }
_mixin void _drain_val(void* x, ...) { IGNORE(x); } // This compiles to no-op on -O0 and -O2+ due to `gnu_inline` (_mixin)
#define _drain(...) _drain_val(NULL, __VA_ARGS__)
#define IGNORE_ALL(...) _drain(__VA_ARGS__)

@ -51,7 +51,7 @@ static int map_haystacks(const char* const * h, map_t maps[pOUT])
while( (path = *h++) )
{
map_t *pOUT c = maps++;
TRACE("attempting to map `%s' to map %p", path, c);
INFO("Mapping haystack file `%s' (to map addr %p)", path, c);
debug_assert(c);
if(!map_handle_err(map_file(path, false, 0, 0, c)))
//TODO: Handle unmapping previous haystacks before return
@ -92,9 +92,10 @@ inv_args:
//TODO: Iterate through the haystack numbers match results, return the first non-match haystack number through `PROG_RET_MATCH_HAYSTACK_N_FAILED(n)` (haystack numbers are always nonzero). If all were matched, return 0
for(int i=0;i<(argc-2);i++) {
TRACE("Attempting to unmap haystack %d (%p, `%s')", i, haystacks+i, argv[i+1]);
INFO("Unmapping haystack haystack file `%s' (#%d) (map addr %p)", argv[i+1], i+1, haystacks+i);
if(!map_handle_err(map_free(haystacks[i]))) return PROG_RET_UNMAP_HAYSTACK_N_FAILED(i+1);
}
INFO("Unmapping needle file `%s'", *argv);
if(!map_handle_err(map_free(needle))) return PROG_RET_UNMAP_NEEDLE_FAILED;
TRACE("main end");
return 0;

Loading…
Cancel
Save