]>
Commit | Line | Data |
---|---|---|
3ebc8300 | 1 | /* |
f70aedc4 | 2 | * Copyright (C) 1996-2021 The Squid Software Foundation and contributors |
3ebc8300 | 3 | * |
bbc27441 AJ |
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. | |
3ebc8300 FC |
7 | */ |
8 | ||
9 | #include "squid.h" | |
8fcefb30 | 10 | #include "base/RegexPattern.h" |
6226856f | 11 | #include <utility> |
3ebc8300 | 12 | |
c2afddd8 | 13 | RegexPattern::RegexPattern(int aFlags, const char *aPattern) : |
ecf28cbe | 14 | flags(aFlags), |
c2afddd8 AJ |
15 | pattern(xstrdup(aPattern)) |
16 | { | |
17 | memset(®ex, 0, sizeof(regex)); | |
18 | } | |
19 | ||
20 | RegexPattern::RegexPattern(RegexPattern &&o) : | |
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 | ||
29 | RegexPattern::~RegexPattern() | |
30 | { | |
31 | xfree(pattern); | |
32 | regfree(®ex); | |
33 | } | |
388e5028 | 34 | |
b9a9207b AJ |
35 | RegexPattern & |
36 | RegexPattern::operator =(RegexPattern &&o) | |
37 | { | |
6226856f | 38 | flags = std::move(o.flags); |
b9a9207b | 39 | regex = std::move(o.regex); |
c2afddd8 AJ |
40 | memset(&o.regex, 0, sizeof(o.regex)); |
41 | pattern = std::move(o.pattern); | |
b9a9207b AJ |
42 | o.pattern = nullptr; |
43 | return *this; | |
44 | } | |
3e8d4ad8 | 45 |