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
e29f5221
Commit
e29f5221
authored
Jun 29, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post review fixes to a patch
mysys/default_modify.c: post revew fixes to a patch
parent
6311217a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
mysys/default_modify.c
mysys/default_modify.c
+15
-8
No files found.
mysys/default_modify.c
View file @
e29f5221
...
@@ -70,8 +70,9 @@ int modify_defaults_file(const char *file_location, const char *option,
...
@@ -70,8 +70,9 @@ int modify_defaults_file(const char *file_location, const char *option,
char
linebuff
[
BUFF_SIZE
],
*
src_ptr
,
*
dst_ptr
,
*
file_buffer
;
char
linebuff
[
BUFF_SIZE
],
*
src_ptr
,
*
dst_ptr
,
*
file_buffer
;
uint
opt_len
,
optval_len
,
sect_len
,
nr_newlines
=
0
,
buffer_size
;
uint
opt_len
,
optval_len
,
sect_len
,
nr_newlines
=
0
,
buffer_size
;
my_bool
in_section
=
FALSE
,
opt_applied
=
0
;
my_bool
in_section
=
FALSE
,
opt_applied
=
0
;
int
reserve_occupied
=
0
,
reserve_extended
=
1
,
old_opt_len
;
uint
reserve_extended
=
1
,
old_opt_len
=
0
;
int
new_opt_len
=
opt_len
+
1
+
optval_len
+
NEWLINE_LEN
;
uint
new_opt_len
=
opt_len
+
1
+
optval_len
+
NEWLINE_LEN
;
int
reserve_occupied
=
0
;
DBUG_ENTER
(
"modify_defaults_file"
);
DBUG_ENTER
(
"modify_defaults_file"
);
if
(
!
(
cnf_file
=
my_fopen
(
file_location
,
O_RDWR
|
O_BINARY
,
MYF
(
0
))))
if
(
!
(
cnf_file
=
my_fopen
(
file_location
,
O_RDWR
|
O_BINARY
,
MYF
(
0
))))
...
@@ -133,14 +134,20 @@ int modify_defaults_file(const char *file_location, const char *option,
...
@@ -133,14 +134,20 @@ int modify_defaults_file(const char *file_location, const char *option,
*/
*/
if
(
opt_applied
)
if
(
opt_applied
)
{
{
old_opt_len
=
strlen
(
linebuff
);
src_ptr
+=
opt_len
;
/* If we correct an option, we know it's name */
old_opt_len
=
opt_len
;
while
(
*
src_ptr
++
)
/* Find the end of the line */
old_opt_len
++
;
/* could be negative */
/* could be negative */
reserve_occupied
+=
new_opt_len
-
old_opt_len
;
reserve_occupied
+=
(
int
)
new_opt_len
-
(
int
)
old_opt_len
;
if
(
reserve_occupied
>
RESERVE
*
reserve_extended
)
if
(
(
int
)
reserve_occupied
>
(
int
)
(
RESERVE
*
reserve_extended
)
)
{
{
file_buffer
=
(
char
*
)
my_realloc
(
file_buffer
,
buffer_size
+
if
(
!
(
file_buffer
=
(
char
*
)
my_realloc
(
file_buffer
,
buffer_size
+
RESERVE
*
reserve_extended
,
RESERVE
*
reserve_extended
,
MYF
(
MY_WME
));
MYF
(
MY_WME
|
MY_FREE_ON_ERROR
))))
goto
malloc_err
;
reserve_extended
++
;
reserve_extended
++
;
}
}
}
}
...
...
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