diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-05-30 12:32:31 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-05-30 12:32:31 +0300 |
commit | a14a6881538229cd938282bd56c7f0d12a089be6 (patch) | |
tree | 89cfa47078460e7505c1a80ce71488eef29dfc63 /tests | |
parent | 07caec236e3af48973874f2c0e19bafec4d13f78 (diff) | |
download | gdbm-a14a6881538229cd938282bd56c7f0d12a089be6.tar.gz gdbm-a14a6881538229cd938282bd56c7f0d12a089be6.tar.bz2 |
Drop debugging hooks
The hooks were introduced as a temporary tool in de7834e9. They did
their job and are not necessary any more.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gtload.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/tests/gtload.c b/tests/gtload.c index 273ebbe..21c89b2 100644 --- a/tests/gtload.c +++ b/tests/gtload.c @@ -36,42 +36,12 @@ err_printer (void *data, char const *fmt, ...) va_start (ap, fmt); vfprintf (stderr, fmt, ap); va_end (ap); fprintf (stderr, "\n"); } -struct hook_closure -{ - unsigned skip; - unsigned hits; - int disabled; -}; - -static int -hookfn (char const *file, int line, char const *id, void *data) -{ - struct hook_closure *clos = data; - - if (clos->disabled) - return 0; - if (clos->skip) - { - --clos->skip; - return 0; - } - if (clos->hits) - { - if (--clos->hits == 0) - clos->disabled = 1; - } - - if (verbose) - fprintf (stderr, "%s:%d: hit debug hook %s\n", file, line, id); - return -1; -} - size_t read_size (char const *arg) { char *p; size_t ret; @@ -91,43 +61,12 @@ read_size (char const *arg) exit (1); } return ret; } -void -install_hook (char *id) -{ - char *p = strchr (id, ';'); - struct hook_closure *clos = malloc (sizeof (*clos)); - assert (clos != NULL); - memset (clos, 0, sizeof (*clos)); - if (p) - { - char *q; - - *p++ = 0; - for (q = strtok (p, ";"); q; q = strtok (NULL, ";")) - { - if (strncmp (q, "skip=", 5) == 0) - clos->skip = strtoul (q + 5, NULL, 10); - else if (strncmp (q, "hits=", 5) == 0) - clos->hits = strtoul (q + 5, NULL, 10); - else - { - fprintf (stderr, "%s: unknown parameter for hook %s: %s", - progname, id, q); - exit (1); - } - } - } -#ifdef GDBM_DEBUG_ENABLE - _gdbm_debug_hook_install (id, hookfn, clos); -#endif -} - #ifdef GDBM_DEBUG_ENABLE void debug_printer (char const *fmt, ...) { va_list ap; @@ -192,19 +131,12 @@ main (int argc, char **argv) else if (strncmp (arg, "-blocksize=", 11) == 0) block_size = atoi (arg + 11); else if (strncmp (arg, "-maxmap=", 8) == 0) mapped_size_max = read_size (arg + 8); else if (strncmp (arg, "-delim=", 7) == 0) delim = arg[7]; -#if GDBM_DEBUG_ENABLE - else if (strncmp (arg, "-hook=", 6) == 0) - { - install_hook (arg + 6); - recover = 1; - } -#endif else if (strcmp (arg, "-recover") == 0) recover = 1; else if (strcmp (arg, "-verbose") == 0) { verbose = 1; rcvr.errfun = err_printer; |