Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
80552aea
Commit
80552aea
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: elide an intermediate copy of some line data
parent
dfbabc04
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nano.c
+3
-6
src/nano.c
with
3 additions
and
6 deletions
+3
-6
src/nano.c
View file @
80552aea
...
...
@@ -246,23 +246,20 @@ partition *partition_filestruct(filestruct *top, size_t top_x,
* at (filebot, strlen(filebot->data)) again. */
void
unpartition_filestruct
(
partition
**
p
)
{
char
*
tmp
;
assert
(
p
!=
NULL
&&
openfile
->
fileage
!=
NULL
&&
openfile
->
filebot
!=
NULL
);
/* Reattach the line above the top of the partition, and restore the
* text before top_x from top_data. Free top_data when we're done
* with it. */
tmp
=
mallocstrcpy
(
NULL
,
openfile
->
fileage
->
data
);
openfile
->
fileage
->
prev
=
(
*
p
)
->
top_prev
;
if
(
openfile
->
fileage
->
prev
!=
NULL
)
openfile
->
fileage
->
prev
->
next
=
openfile
->
fileage
;
openfile
->
fileage
->
data
=
charealloc
(
openfile
->
fileage
->
data
,
strlen
((
*
p
)
->
top_data
)
+
strlen
(
openfile
->
fileage
->
data
)
+
1
);
strcpy
(
openfile
->
fileage
->
data
,
(
*
p
)
->
top_data
);
charmove
(
openfile
->
fileage
->
data
+
strlen
((
*
p
)
->
top_data
),
openfile
->
fileage
->
data
,
strlen
(
openfile
->
fileage
->
data
)
+
1
);
strncpy
(
openfile
->
fileage
->
data
,
(
*
p
)
->
top_data
,
strlen
((
*
p
)
->
top_data
));
free
((
*
p
)
->
top_data
);
strcat
(
openfile
->
fileage
->
data
,
tmp
);
free
(
tmp
);
/* Reattach the line below the bottom of the partition, and restore
* the text after bot_x from bot_data. Free bot_data when we're
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help