Change the way the data is held in memory

The previous implementation was very inefficient RAM-wise. By making the
entry structure data agnostic, I expect a 9 fold decrease of RAM usage.

The main structure has been renamed search because it makes more sense.
sprintf becomes snprintf and we don't segfault

Yeepee
Remove double mutex init
Remove magics

Also rename NAME_MAX to LINE_MAX
Remove unused variables
sanitize_filename is no longer needed

I wonder why ?
Make ngp search agnostic

"search" is being replaced by "current" or "mainsearch" where relevant,
where current is a pointer on the search structure.

This will allow search structures to have children in later patches,
thus enabling the search in search mechanism.
fix display of last entry