Fix crash with bulk pattern replacements (introduced with c83a93e)
commit5412a244ba903624053cdaf7393732bc3af689ea
authorColomban Wendling <ban@herbesfolles.org>
Fri, 12 Apr 2013 16:07:30 +0000 (12 18:07 +0200)
committerColomban Wendling <ban@herbesfolles.org>
Sat, 13 Apr 2013 15:06:47 +0000 (13 17:06 +0200)
tree7badc4ba8205f4713bd84d1f6ffe8e33a27d7a34
parent920969ebb1858aaaa2ff22573eae6c25a510b95f
Fix crash with bulk pattern replacements (introduced with c83a93e)

"regex_match_text" and "regex_matches" being globals, performing
several searches and then the replacements separately lead to them
having unexpected values, resulting in incorrect behavior and crash.

Fix this by removing the globals and instead make the search functions
return match details.  Not only this fixes the issue, but also make the
code a lot more maintainable by not having globals introducing side
effects (proof of them being an issue is that c83a93e inadvertently
broke things bad).
src/document.c
src/document.h
src/search.c
src/search.h