Skip to content

libft_mod

Ilya Kashnitskiy edited this page Jan 19, 2020 · 4 revisions

The ft_libft_mod.h file allows you to easily change the library build options.

  • # define USE_LIBC

If USE_LIBC defined (by default), all functions from ft_libc.h will call their counterpart from the original libc.

Comment out this line and recompile the library. Now libft uses my self-writted functions.

  • # define FORCE_BUFF_POLICY

This macro defines the ft_printf() mode. If it defined like this (by default)

# define FORCE_BUFF_POLICY HOLD_OVER_FORCE

then ft_printf() will just put the data in the output buffer.

Otherwise, if it defined like this

# define FORCE_BUFF_POLICY IMMIDIATLY_FORCE

then ft_printf() will not only put the data in the output buffer but also forcibly print it too!

Don't forget to recompile library, to accept changes!

  • # define USE_MEM_MAN

If this macro defined (by default), the memory manager will be used.

Comment out this line and recompile the library. Now libft doesn't use memory manager.

  • # define XMALLOC_MOD

If you turn off memory manager then (by defaul) this macro enables the mode in which ft_malloc() will either successfully allocate memory or exit the program by printing an error message and calling exit().

Comment out this line and recompile the library.Now ft_malloc() is equivalent to the standard malloc().

Not safe! Disable the memory manager and xmalloc_mod only if you know exactly what you are doing!

GO TO NEXT PAGE --->