RegexPattern.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #include "squid.h"
10 #include "base/RegexPattern.h"
11 #include <utility>
12 
13 RegexPattern::RegexPattern(int aFlags, const char *aPattern) :
14  flags(aFlags),
15  pattern(xstrdup(aPattern))
16 {
17  memset(&regex, 0, sizeof(regex));
18 }
19 
21  flags(std::move(o.flags)),
22  regex(std::move(o.regex)),
23  pattern(std::move(o.pattern))
24 {
25  memset(&o.regex, 0, sizeof(o.regex));
26  o.pattern = nullptr;
27 }
28 
30 {
31  xfree(pattern);
32  regfree(&regex);
33 }
34 
37 {
38  flags = std::move(o.flags);
39  regex = std::move(o.regex);
40  memset(&o.regex, 0, sizeof(o.regex));
41  pattern = std::move(o.pattern);
42  o.pattern = nullptr;
43  return *this;
44 }
45 
char * pattern
Definition: RegexPattern.h:43
#define xstrdup
void regfree(regex_t *preg)
Definition: GnuRegex.c:4283
RegexPattern()=delete
regex_t regex
Definition: RegexPattern.h:40
RegexPattern & operator=(const RegexPattern &)=delete
#define xfree

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors