#
#
# patch "ChangeLog"
# from [59ff63b9f2b1f9cfbe8c39483127487fbef17381]
# to [1b1b7c07088e736bb647b6e730e5461973158d8a]
#
# patch "pcrewrap.cc"
# from [ed186faf44253b9bf2d169bb900a31bd75c479f2]
# to [4dc70cfb7a55e24b3fd86a0324487f645e25db2c]
#
# patch "pcrewrap.hh"
# from [7cb55a52af7a1085561a5ace6451893fce56d804]
# to [701afe7a88a0cbb36c0b38afb6a03050f22f89b4]
#
============================================================
--- ChangeLog 59ff63b9f2b1f9cfbe8c39483127487fbef17381
+++ ChangeLog 1b1b7c07088e736bb647b6e730e5461973158d8a
@@ -1,5 +1,9 @@ 2006-12-27 Zack Weinberg
+ * pcrewrap.cc, pcrewrap.hh: Change "const T" to "T const" throughout.
+
+2006-12-27 Zack Weinberg
+
* pcrewrap.cc, pcrewrap.hh: Remove redundant includes.
Add a couple of "using"s. Improve commentary. Fix formatting.
Add editor control comments to bottoms of files, and de-tabify.
============================================================
--- pcrewrap.cc ed186faf44253b9bf2d169bb900a31bd75c479f2
+++ pcrewrap.cc 4dc70cfb7a55e24b3fd86a0324487f645e25db2c
@@ -32,29 +32,29 @@ flags_to_internal(pcre::flags f)
return i;
}
-inline std::pair
+inline std::pair
compile(const char * pattern, pcre::flags options)
{
int erroff;
- const char * err;
- const pcre_t * basedat = pcre_compile(pattern, flags_to_internal(options),
+ char const * err;
+ pcre_t const * basedat = pcre_compile(pattern, flags_to_internal(options),
&err, &erroff, 0);
if (!basedat)
throw pcre::compile_error(err, erroff, pattern);
- const pcre_extra * extradat = pcre_study(basedat, 0, &err);
+ pcre_extra const * extradat = pcre_study(basedat, 0, &err);
if (err)
throw pcre::study_error(err);
- return std::make_pair(static_cast(basedat),
- static_cast(extradat));
+ return std::make_pair(static_cast(basedat),
+ static_cast(extradat));
}
inline unsigned int
-get_capturecount(const void * bd)
+get_capturecount(void const * bd)
{
unsigned int cc;
- int err = pcre_fullinfo(static_cast(bd), 0,
+ int err = pcre_fullinfo(static_cast(bd), 0,
PCRE_INFO_CAPTURECOUNT,
static_cast(&cc));
if (err < 0)
@@ -64,11 +64,11 @@ namespace pcre
namespace pcre
{
- regex::regex(const char * pattern, flags options)
+ regex::regex(char const * pattern, flags options)
: basic_regex(compile(pattern, options))
{}
- regex::regex(const string & pattern, flags options)
+ regex::regex(string const & pattern, flags options)
: basic_regex(compile(pattern.c_str(), options))
{}
@@ -81,7 +81,7 @@ namespace pcre
}
bool
- basic_regex::match(const string & subject, matches & result,
+ basic_regex::match(string const & subject, matches & result,
string::const_iterator startptr,
flags options) const
{
@@ -102,8 +102,8 @@ namespace pcre
if (startptr != string::const_iterator(0))
startoffset = &*startptr - &*subject.data();
- int rc = pcre_exec(static_cast(basedat),
- static_cast(extradat),
+ int rc = pcre_exec(static_cast(basedat),
+ static_cast(extradat),
subject.data(), subject.size(),
startoffset,
flags_to_internal(options),
@@ -147,7 +147,7 @@ namespace pcre
// This overload is for when you don't care about captures, only
// whether or not it matched.
bool
- basic_regex::match(const string & subject,
+ basic_regex::match(string const & subject,
string::const_iterator startptr,
flags options) const
{
@@ -155,8 +155,8 @@ namespace pcre
if (startptr != string::const_iterator(0))
startoffset = &*startptr - &*subject.data();
- int rc = pcre_exec(static_cast(basedat),
- static_cast(extradat),
+ int rc = pcre_exec(static_cast(basedat),
+ static_cast(extradat),
subject.data(), subject.size(),
startoffset, flags_to_internal(options), 0, 0);
if (rc == 0)
@@ -170,14 +170,14 @@ namespace pcre
// error handling.
static string
- compile_error_message(const char * err, int offset, const char * pattern)
+ compile_error_message(char const * err, int offset, char const * pattern)
{
return (F("parse error at char %d in pattern '%s': %s")
% offset % pattern % err).str();
}
- compile_error::compile_error(const char * err, int offset,
- const char * pattern)
+ compile_error::compile_error(char const * err, int offset,
+ char const * pattern)
: std::runtime_error(compile_error_message(err, offset, pattern))
{}
============================================================
--- pcrewrap.hh 7cb55a52af7a1085561a5ace6451893fce56d804
+++ pcrewrap.hh 701afe7a88a0cbb36c0b38afb6a03050f22f89b4
@@ -76,27 +76,26 @@ namespace pcre
private:
// disable the default and copy constructors
basic_regex();
- basic_regex(const basic_regex &);
- basic_regex & operator=(const basic_regex &);
+ basic_regex(basic_regex const &);
+ basic_regex & operator=(basic_regex const &);
protected:
- const void * const basedat;
- const void * const extradat;
+ void const * const basedat;
+ void const * const extradat;
// for use only by subclass constructors
- basic_regex(const void * b, const void * e) : basedat(b), extradat(e) {}
- basic_regex(std::pair p)
+ basic_regex(std::pair p)
: basedat(p.first), extradat(p.second) {}
public:
~basic_regex() {}
- bool match(const std::string & subject, matches & result,
+ bool match(std::string const & subject, matches & result,
std::string::const_iterator startoffset
= std::string::const_iterator(),
pcre::flags options = DEFAULT) const;
- bool match(const std::string & subject,
+ bool match(std::string const & subject,
std::string::const_iterator startoffset
= std::string::const_iterator(),
pcre::flags options = DEFAULT) const;
@@ -104,7 +103,7 @@ namespace pcre
// helper function which starts successive matches at the position
// where the last match left off.
- bool nextmatch(const std::string & subject, matches & result,
+ bool nextmatch(std::string const & subject, matches & result,
pcre::flags options = DEFAULT) const
{
std::string::const_iterator startoffset(0);
@@ -117,8 +116,8 @@ namespace pcre
// A regex is the class you are intended to use directly, in normal usage.
struct regex : public basic_regex
{
- regex(const char * pattern, pcre::flags options = DEFAULT);
- regex(const std::string & pattern, pcre::flags options = DEFAULT);
+ regex(char const * pattern, pcre::flags options = DEFAULT);
+ regex(std::string const & pattern, pcre::flags options = DEFAULT);
~regex();
};