Commit 917c66d3 authored by Geoff Simmons's avatar Geoff Simmons

add some consts

parent 72c8d31d
......@@ -56,14 +56,14 @@ vre2::~vre2() {
}
inline bool
vre2::match(const char *subject, int ngroups, StringPiece* groups)
vre2::match(const char *subject, const int ngroups, StringPiece* groups) const
{
return re_->Match(subject, 0, strlen(subject), RE2::UNANCHORED,
groups, ngroups + 1);
}
inline int
vre2::ngroups()
inline const int
vre2::ngroups() const
{
return re_->NumberOfCapturingGroups();
}
......@@ -85,8 +85,8 @@ vre2_matchsz(void)
}
const char *
vre2_match(vre2 *vre2, const char *subject, int *match, int ngroups,
void *group)
vre2_match(vre2 *vre2, const char * const subject, int * const match,
const int ngroups, void * const group)
{
try {
StringPiece* g = reinterpret_cast<StringPiece *>(group);
......@@ -97,7 +97,8 @@ vre2_match(vre2 *vre2, const char *subject, int *match, int ngroups,
}
const char *
vre2_capture(void *group, int refnum, const char **capture, int *len)
vre2_capture(void *group, const int refnum, const char ** const capture,
int * const len)
{
try {
StringPiece* g = reinterpret_cast<StringPiece *>(group);
......@@ -110,7 +111,7 @@ vre2_capture(void *group, int refnum, const char **capture, int *len)
}
const char *
vre2_ngroups(vre2 *vre2, int *ngroups)
vre2_ngroups(vre2 *vre2, int * const ngroups)
{
try {
*ngroups = vre2->ngroups();
......
......@@ -43,8 +43,8 @@ private:
public:
vre2(const char *pattern);
virtual ~vre2();
bool match(const char *subject, int ngroups, StringPiece* groups);
int ngroups();
bool match(const char *subject, int ngroups, StringPiece* groups) const;
const int ngroups() const;
};
#else
typedef struct vre2 vre2;
......@@ -54,14 +54,15 @@ typedef struct vre2 vre2;
extern "C" {
#endif
const char *vre2_init(vre2 **vre2, const char *pattern);
const char *vre2_init(vre2 **vre2, const char * pattern);
const char *vre2_fini(vre2 **vre2);
const size_t vre2_matchsz(void);
const char *vre2_ngroups(vre2 *vre2, int *ngroups);
const char *vre2_match(vre2 *vre2, const char *subject, int *match,
int ngroups, void *group);
const char *vre2_capture(void *group, int refnum, const char **capture,
int *len);
const char *vre2_ngroups(vre2 *vre2, int * const ngroups);
const char *vre2_match(vre2 *vre2, const char * const subject,
int * const match, int ngroups,
void * const group);
const char *vre2_capture(void *group, int refnum,
const char ** const capture, int * const len);
#ifdef __cplusplus
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment