libctf: lowest-level memory allocation and debug-dumping wrappers

The memory-allocation wrappers are simple things to allow malloc
interposition: they are only used inconsistently at present, usually
where malloc debugging was required in the past.

These provide a default implementation that is environment-variable
triggered (initialized on the first call to the libctf creation and
file-opening functions, the first functions people will use), and
a ctf_setdebug()/ctf_getdebug() pair that allows the caller to
explicitly turn debugging off and on.  If ctf_setdebug() is called,
the automatic setting from an environment variable is skipped.

libctf/
	* ctf-impl.h: New file.
	* ctf-subr.c: New file.

include/
	* ctf-api.h (ctf_setdebug): New.
	(ctf_getdebug): Likewise.
This commit is contained in:
Nick Alcock
2019-04-23 18:55:27 +01:00
parent 2e94b05630
commit 60da9d9559
5 changed files with 330 additions and 0 deletions

View File

@ -123,6 +123,9 @@ enum
#define CTF_ADD_ROOT 1 /* Type visible at top-level scope. */
extern void ctf_setdebug (int debug);
extern int ctf_getdebug (void);
#ifdef __cplusplus
}
#endif