jsonn/apropos_replacement — pull request #2 by abhinav-upadhyay (2012-01-29 20:12:41+00:00)
Title: Fixes for some last few issues which were left

There were a few more issues that I noticed.

1.We are maintaining the size of all the section buffers in the offset member of the struct. The sqlite3_bind_text* functions expect the number of bytes of the text as their 4th parameter. So I thought, it makes sense to supply this information to sqlite.

2. The pmdoc_Sh() function had a bug. It was calling pmdoc_macro_handler() to handle the parsing of Xr macros. The child node was being explored by pmdoc_macro_handler itself and after returning from there, pmdoc_Sh() was recursively traversing the child node again, which was causing duplication of data. Fixed this by using a flag variable.

3. And in insert_into_db() at the very end, rec->links was being modified by strtok. Prevented the memory leak by using a temporary variable.