Skip to content
GitLab
Menu
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
a57c6a67
Commit
a57c6a67
authored
6 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: elide a one-line function that is used just twice
parent
597d9020
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/files.c
+2
-4
src/files.c
src/proto.h
+0
-1
src/proto.h
src/utils.c
+0
-6
src/utils.c
with
2 additions
and
11 deletions
+2
-11
src/files.c
View file @
a57c6a67
...
...
@@ -1472,8 +1472,7 @@ void init_operating_dir(void)
die
(
_
(
"Invalid operating directory: %s
\n
"
),
operating_dir
);
free
(
operating_dir
);
operating_dir
=
target
;
snuggly_fit
(
&
operating_dir
);
operating_dir
=
charealloc
(
target
,
strlen
(
target
)
+
1
);
}
/* Check whether the given path is outside of the operating directory.
...
...
@@ -1540,8 +1539,7 @@ void init_backup_dir(void)
die
(
_
(
"Invalid backup directory: %s
\n
"
),
backup_dir
);
free
(
backup_dir
);
backup_dir
=
target
;
snuggly_fit
(
&
backup_dir
);
backup_dir
=
charealloc
(
target
,
strlen
(
target
)
+
1
);
}
#endif
/* !NANO_TINY */
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
a57c6a67
...
...
@@ -557,7 +557,6 @@ int digits(ssize_t n);
#endif
bool
parse_num
(
const
char
*
str
,
ssize_t
*
val
);
bool
parse_line_column
(
const
char
*
str
,
ssize_t
*
line
,
ssize_t
*
column
);
void
snuggly_fit
(
char
**
str
);
void
null_at
(
char
**
data
,
size_t
index
);
void
unsunder
(
char
*
str
,
size_t
true_len
);
void
sunder
(
char
*
str
);
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
a57c6a67
...
...
@@ -159,12 +159,6 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
return
retval
;
}
/* Reduce the memory allocation of a string to what is needed. */
void
snuggly_fit
(
char
**
string
)
{
*
string
=
charealloc
(
*
string
,
strlen
(
*
string
)
+
1
);
}
/* Null a string at a certain index and align it. */
void
null_at
(
char
**
data
,
size_t
index
)
{
...
...
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