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
1d3d3077
Commit
1d3d3077
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: more consistently use * instead of [0] when checking for '\0'
parent
2fae87d9
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/browser.c
+5
-6
src/browser.c
src/prompt.c
+1
-1
src/prompt.c
src/search.c
+3
-3
src/search.c
with
9 additions
and
10 deletions
+9
-10
src/browser.c
View file @
1d3d3077
...
...
@@ -681,7 +681,7 @@ int filesearch_init(void)
int
input
;
char
*
buf
;
if
(
last_search
[
0
]
!=
'\0'
)
{
if
(
*
last_search
!=
'\0'
)
{
char
*
disp
=
display_string
(
last_search
,
0
,
COLS
/
3
,
FALSE
);
buf
=
charalloc
(
strlen
(
disp
)
+
7
);
...
...
@@ -787,9 +787,8 @@ void do_filesearch(void)
last_search
=
mallocstrcpy
(
last_search
,
answer
);
#ifndef DISABLE_HISTORIES
/* If answer is not "", add this search string to the search history
* list. */
if
(
answer
[
0
]
!=
'\0'
)
/* If answer is not empty, add the string to the search history list. */
if
(
*
answer
!=
'\0'
)
update_history
(
&
search_history
,
answer
);
#endif
...
...
@@ -798,10 +797,10 @@ void do_filesearch(void)
bottombars
(
MBROWSER
);
}
/* Search for the last given filename
again
without prompting. */
/* Search
again
for the last given filename
,
without prompting. */
void
do_fileresearch
(
void
)
{
if
(
last_search
[
0
]
==
'\0'
)
if
(
*
last_search
==
'\0'
)
statusbar
(
_
(
"No current search pattern"
));
else
findnextfile
(
last_search
);
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
1d3d3077
...
...
@@ -629,7 +629,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
if
(
history_list
!=
NULL
)
{
/* If we're scrolling up at the bottom of the history list
* and answer isn't blank, save answer in magichistory. */
if
((
*
history_list
)
->
next
==
NULL
&&
answer
[
0
]
!=
'\0'
)
if
((
*
history_list
)
->
next
==
NULL
&&
*
answer
!=
'\0'
)
magichistory
=
mallocstrcpy
(
magichistory
,
answer
);
/* Get the older search from the history list and save it in
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
1d3d3077
...
...
@@ -142,7 +142,7 @@ int search_init(bool replacing, bool use_answer)
* do_search() or do_replace() and be called again. In that case,
* we should put the same search string back up. */
if
(
last_search
[
0
]
!=
'\0'
)
{
if
(
*
last_search
!=
'\0'
)
{
char
*
disp
=
display_string
(
last_search
,
0
,
COLS
/
3
,
FALSE
);
buf
=
charalloc
(
strlen
(
disp
)
+
7
);
...
...
@@ -465,11 +465,11 @@ void do_research(void)
#ifndef DISABLE_HISTORIES
/* If nothing was searched for yet during this run of nano, but
* there is a search history, take the most recent item. */
if
(
last_search
[
0
]
==
'\0'
&&
searchbot
->
prev
!=
NULL
)
if
(
*
last_search
==
'\0'
&&
searchbot
->
prev
!=
NULL
)
last_search
=
mallocstrcpy
(
last_search
,
searchbot
->
prev
->
data
);
#endif
if
(
last_search
[
0
]
==
'\0'
)
{
if
(
*
last_search
==
'\0'
)
{
statusbar
(
_
(
"No current search pattern"
));
return
;
}
...
...
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