Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Limkilde Svendsen
relibc
Commits
0684fb6e
Verified
Commit
0684fb6e
authored
6 years ago
by
jD91mZM2
Browse files
Options
Downloads
Patches
Plain Diff
Bump posix-regex version
parent
d2528384
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
posix-regex
+1
-1
1 addition, 1 deletion
posix-regex
src/header/fnmatch/mod.rs
+1
-5
1 addition, 5 deletions
src/header/fnmatch/mod.rs
src/header/regex/mod.rs
+3
-25
3 additions, 25 deletions
src/header/regex/mod.rs
with
5 additions
and
31 deletions
posix-regex
@
0d996efe
Compare
bf7d93bb
...
0d996efe
Subproject commit
bf7d93bb7aba406dc135a7a9eb031371e7739fe6
Subproject commit
0d996efe5cfe7ce181af35d8817ac4deae644d4a
This diff is collapsed.
Click to expand it.
src/header/fnmatch/mod.rs
+
1
−
5
View file @
0684fb6e
...
@@ -118,11 +118,7 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Vec<(Token, Range)>
...
@@ -118,11 +118,7 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Vec<(Token, Range)>
}
}
#[no_mangle]
#[no_mangle]
pub
unsafe
extern
"C"
fn
fnmatch
(
pub
unsafe
extern
"C"
fn
fnmatch
(
pattern
:
*
const
c_char
,
input
:
*
const
c_char
,
flags
:
c_int
)
->
c_int
{
mut
pattern
:
*
const
c_char
,
mut
input
:
*
const
c_char
,
flags
:
c_int
,
)
->
c_int
{
let
mut
len
=
0
;
let
mut
len
=
0
;
while
*
input
.offset
(
len
)
!=
0
{
while
*
input
.offset
(
len
)
!=
0
{
len
+=
1
;
len
+=
1
;
...
...
This diff is collapsed.
Click to expand it.
src/header/regex/mod.rs
+
3
−
25
View file @
0684fb6e
...
@@ -49,18 +49,6 @@ pub const REG_ERANGE: c_int = 12;
...
@@ -49,18 +49,6 @@ pub const REG_ERANGE: c_int = 12;
pub
const
REG_ESPACE
:
c_int
=
13
;
pub
const
REG_ESPACE
:
c_int
=
13
;
pub
const
REG_BADRPT
:
c_int
=
14
;
pub
const
REG_BADRPT
:
c_int
=
14
;
fn
count_groups
(
branches
:
&
[
Vec
<
(
Token
,
Range
)
>
])
->
usize
{
let
mut
count
=
0
;
for
branch
in
branches
{
for
(
token
,
_
)
in
branch
{
if
let
Token
::
Group
(
ref
inner
)
=
token
{
count
+=
1
+
count_groups
(
inner
);
}
}
}
count
}
#[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
regcomp
(
out
:
*
mut
regex_t
,
pat
:
*
const
c_char
,
cflags
:
c_int
)
->
c_int
{
pub
extern
"C"
fn
regcomp
(
out
:
*
mut
regex_t
,
pat
:
*
const
c_char
,
cflags
:
c_int
)
->
c_int
{
if
cflags
&
REG_EXTENDED
==
REG_EXTENDED
{
if
cflags
&
REG_EXTENDED
==
REG_EXTENDED
{
...
@@ -74,7 +62,7 @@ pub extern "C" fn regcomp(out: *mut regex_t, pat: *const c_char, cflags: c_int)
...
@@ -74,7 +62,7 @@ pub extern "C" fn regcomp(out: *mut regex_t, pat: *const c_char, cflags: c_int)
match
res
{
match
res
{
Ok
(
mut
branches
)
=>
unsafe
{
Ok
(
mut
branches
)
=>
unsafe
{
let
re_nsub
=
count_groups
(
&
branches
);
let
re_nsub
=
PosixRegex
::
new
(
Cow
::
Borrowed
(
&
branches
))
.
count_groups
();
*
out
=
regex_t
{
*
out
=
regex_t
{
ptr
:
branches
.as_mut_ptr
()
as
*
mut
c_void
,
ptr
:
branches
.as_mut_ptr
()
as
*
mut
c_void
,
length
:
branches
.len
(),
length
:
branches
.len
(),
...
@@ -118,7 +106,6 @@ pub extern "C" fn regexec(regex: *const regex_t, input: *const c_char,
...
@@ -118,7 +106,6 @@ pub extern "C" fn regexec(regex: *const regex_t, input: *const c_char,
let
flags
=
regex
.cflags
|
eflags
;
let
flags
=
regex
.cflags
|
eflags
;
let
input
=
unsafe
{
slice
::
from_raw_parts
(
input
as
*
const
u8
,
strlen
(
input
))
};
let
input
=
unsafe
{
slice
::
from_raw_parts
(
input
as
*
const
u8
,
strlen
(
input
))
};
let
branches
=
unsafe
{
slice
::
from_raw_parts
(
regex
.ptr
as
*
const
Vec
<
(
Token
,
Range
)
>
,
regex
.length
)
};
let
branches
=
unsafe
{
slice
::
from_raw_parts
(
regex
.ptr
as
*
const
Vec
<
(
Token
,
Range
)
>
,
regex
.length
)
};
let
matches
=
PosixRegex
::
new
(
Cow
::
Borrowed
(
&
branches
))
let
matches
=
PosixRegex
::
new
(
Cow
::
Borrowed
(
&
branches
))
...
@@ -134,9 +121,8 @@ pub extern "C" fn regexec(regex: *const regex_t, input: *const c_char,
...
@@ -134,9 +121,8 @@ pub extern "C" fn regexec(regex: *const regex_t, input: *const c_char,
&&
nmatch
>
0
{
&&
nmatch
>
0
{
let
first
=
&
matches
[
0
];
let
first
=
&
matches
[
0
];
let
len
=
first
.len
()
.min
(
nmatch
as
usize
);
for
i
in
0
..
nmatch
as
usize
{
for
i
in
0
..
len
{
let
(
start
,
end
)
=
first
.get
(
i
)
.and_then
(|
&
range
|
range
)
.unwrap_or
((
!
0
,
!
0
));
let
(
start
,
end
)
=
first
[
i
];
unsafe
{
unsafe
{
*
pmatch
.offset
(
i
as
isize
)
=
regmatch_t
{
*
pmatch
.offset
(
i
as
isize
)
=
regmatch_t
{
rm_so
:
start
,
rm_so
:
start
,
...
@@ -144,14 +130,6 @@ pub extern "C" fn regexec(regex: *const regex_t, input: *const c_char,
...
@@ -144,14 +130,6 @@ pub extern "C" fn regexec(regex: *const regex_t, input: *const c_char,
};
};
}
}
}
}
for
i
in
len
as
isize
..
nmatch
as
isize
{
unsafe
{
*
pmatch
.offset
(
i
)
=
regmatch_t
{
rm_so
:
!
0
,
rm_eo
:
!
0
};
}
}
}
}
if
matches
.is_empty
()
{
REG_NOMATCH
}
else
{
0
}
if
matches
.is_empty
()
{
REG_NOMATCH
}
else
{
0
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment