External, Non-PPA KXStudio Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5KB

  1. From: Mark Baker <mark@mnb.org.uk>
  2. Date: Wed, 13 Jul 2016 21:20:13 +0100
  3. Subject: PCRE6_compatible_API
  4. ---
  5. pcrecpp.cc | 6 ++++++
  6. pcrecpp.h | 2 ++
  7. pcretest.c | 2 +-
  8. 3 files changed, 9 insertions(+), 1 deletion(-)
  9. diff --git a/pcrecpp.cc b/pcrecpp.cc
  10. index d09c9ab..728b074 100644
  11. --- a/pcrecpp.cc
  12. +++ b/pcrecpp.cc
  13. @@ -80,6 +80,12 @@ static const string empty_string;
  14. // If the user doesn't ask for any options, we just use this one
  15. static RE_Options default_options;
  16. +// PCRE6.x compatible API
  17. +void RE::Init(const char *c_pat, const RE_Options* options) {
  18. + const string cxx_pat(c_pat);
  19. + Init(cxx_pat, options);
  20. +}
  21. +
  22. void RE::Init(const string& pat, const RE_Options* options) {
  23. pattern_ = pat;
  24. if (options == NULL) {
  25. diff --git a/pcrecpp.h b/pcrecpp.h
  26. index 3e594b0..a520057 100644
  27. --- a/pcrecpp.h
  28. +++ b/pcrecpp.h
  29. @@ -658,6 +658,8 @@ class PCRECPP_EXP_DEFN RE {
  30. private:
  31. void Init(const string& pattern, const RE_Options* options);
  32. + // Old version from PCRE 6.x, for compatibility
  33. + void Init(const char *pattern, const RE_Options* options);
  34. void Cleanup();
  35. // Match against "text", filling in "vec" (up to "vecsize" * 2/3) with
  36. diff --git a/pcretest.c b/pcretest.c
  37. index 78ef517..f42f0a3 100644
  38. --- a/pcretest.c
  39. +++ b/pcretest.c
  40. @@ -2984,7 +2984,7 @@ int main(int argc, char **argv)
  41. {
  42. FILE *infile = stdin;
  43. const char *version;
  44. -int options = 0;
  45. +long int options = 0;
  46. int study_options = 0;
  47. int default_find_match_limit = FALSE;
  48. pcre_uint32 default_options = 0;