mirror of https://github.com/MidnightCommander/mc
(get_first_editor_line): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
8883273bdd
commit
7f7a75f988
|
@ -1386,26 +1386,30 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
get_first_editor_line (WEdit * edit)
|
get_first_editor_line (WEdit * edit)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
static char s[256];
|
static char s[256];
|
||||||
|
|
||||||
s[0] = '\0';
|
s[0] = '\0';
|
||||||
if (edit == NULL)
|
|
||||||
return s;
|
|
||||||
|
|
||||||
for (i = 0; i < sizeof (s) - 1; i++)
|
if (edit != NULL)
|
||||||
{
|
{
|
||||||
s[i] = edit_get_byte (edit, i);
|
size_t i;
|
||||||
if (s[i] == '\n')
|
|
||||||
|
for (i = 0; i < sizeof (s) - 1; i++)
|
||||||
{
|
{
|
||||||
s[i] = '\0';
|
s[i] = edit_get_byte (edit, i);
|
||||||
break;
|
if (s[i] == '\n')
|
||||||
|
{
|
||||||
|
s[i] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s[sizeof (s) - 1] = '\0';
|
||||||
}
|
}
|
||||||
s[sizeof (s) - 1] = '\0';
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue