Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
dcdf7a64
Commit
dcdf7a64
authored
May 01, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config_StringEscape: iterate through string twice rather than 3 times
parent
87ea4084
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
20 deletions
+11
-20
src/config/chain.c
src/config/chain.c
+11
-20
No files found.
src/config/chain.c
View file @
dcdf7a64
...
...
@@ -451,32 +451,23 @@ char *config_StringUnescape( char *psz_string )
return
psz_string
;
}
char
*
config_StringEscape
(
const
char
*
psz_string
)
char
*
config_StringEscape
(
const
char
*
str
)
{
char
*
psz_return
;
char
*
psz_dst
;
int
i_escape
;
size_t
length
=
0
;
if
(
!
psz_string
)
if
(
str
==
NULL
)
return
NULL
;
i_escape
=
0
;
for
(
const
char
*
p
=
psz_string
;
*
p
;
p
++
)
{
if
(
IsEscapeNeeded
(
*
p
)
)
i_escape
++
;
}
for
(
const
char
*
p
=
str
;
*
p
;
p
++
)
length
+=
IsEscapeNeeded
(
*
p
)
?
2
:
1
;
psz_return
=
psz_dst
=
malloc
(
strlen
(
psz_string
)
+
i_escape
+
1
)
;
for
(
const
char
*
p
=
psz_string
;
*
p
;
p
++
)
char
*
ret
=
xmalloc
(
length
+
1
),
*
dst
=
ret
;
for
(
const
char
*
p
=
str
;
*
p
;
p
++
)
{
if
(
IsEscapeNeeded
(
*
p
)
)
*
psz_
dst
++
=
'\\'
;
*
psz_
dst
++
=
*
p
;
*
dst
++
=
'\\'
;
*
dst
++
=
*
p
;
}
*
psz_dst
=
'\0'
;
return
psz_return
;
*
dst
=
'\0'
;;
return
ret
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment