Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
205f7a05
Commit
205f7a05
authored
Jan 19, 2007
by
iggy@recycle.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge recycle.(none):/src/bug22807/my50-bug22807
into recycle.(none):/src/mysql-5.0-maint
parents
20faa77a
d3e6cb6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
mysys/string.c
mysys/string.c
+13
-15
No files found.
mysys/string.c
View file @
205f7a05
...
...
@@ -131,37 +131,35 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
my_bool
dynstr_append_os_quoted
(
DYNAMIC_STRING
*
str
,
const
char
*
append
,
...)
{
#ifdef __WIN__
char
quote_str
[]
=
"
\"
"
;
const
char
*
quote_str
=
"
\"
"
;
const
uint
quote_len
=
1
;
#else
char
quote_str
[]
=
"
\'
"
;
const
char
*
quote_str
=
"
\'
"
;
const
uint
quote_len
=
1
;
#endif
/* __WIN__ */
my_bool
ret
=
TRUE
;
va_list
dirty_text
;
ret
&=
dynstr_append
(
str
,
quote_str
);
/* Leading quote */
va_start
(
dirty_text
,
append
);
ret
&=
dynstr_append
_mem
(
str
,
quote_str
,
quote_len
);
/* Leading quote */
va_start
(
dirty_text
,
append
);
while
(
append
!=
NullS
)
{
c
har
*
cur_pos
=
append
;
char
*
next_pos
=
cur_pos
;
c
onst
char
*
cur_pos
=
append
;
c
onst
c
har
*
next_pos
=
cur_pos
;
/* Search for quote in each string and replace with escaped quote */
while
(
*
(
next_pos
=
strcend
(
cur_pos
,
quote_str
[
0
]))
!=
'\0'
)
{
char
*
tmp_buff
=
my_malloc
((
next_pos
-
cur_pos
)
+
1
,
MYF
(
MY_ZEROFILL
));
strnmov
(
tmp_buff
,
cur_pos
,
(
next_pos
-
cur_pos
));
ret
&=
dynstr_append
(
str
,
tmp_buff
);
my_free
((
gptr
)
tmp_buff
,
MYF
(
0
));
ret
&=
dynstr_append
(
str
,
"
\\
"
);
ret
&=
dynstr_append
(
str
,
quote_str
);
ret
&=
dynstr_append_mem
(
str
,
cur_pos
,
next_pos
-
cur_pos
);
ret
&=
dynstr_append_mem
(
str
,
"
\\
"
,
1
);
ret
&=
dynstr_append_mem
(
str
,
quote_str
,
quote_len
);
cur_pos
=
next_pos
+
1
;
}
ret
&=
dynstr_append
(
str
,
cur_pos
);
ret
&=
dynstr_append
_mem
(
str
,
cur_pos
,
next_pos
-
cur_pos
);
append
=
va_arg
(
dirty_text
,
char
*
);
}
va_end
(
dirty_text
);
ret
&=
dynstr_append
(
str
,
quote_str
);
/* Trailing quote */
ret
&=
dynstr_append
_mem
(
str
,
quote_str
,
quote_len
);
/* Trailing quote */
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