tweaks: elide two parameters from the get_region() function
parent
4b8a387529
commit
25b1114e03
|
@ -609,8 +609,7 @@ void remove_magicline(void);
|
|||
#ifndef NANO_TINY
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
void get_region(const filestruct **top, size_t *top_x,
|
||||
const filestruct **bot, size_t *bot_x);
|
||||
void get_region(const filestruct **top, const filestruct **bot);
|
||||
#endif
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||
#ifndef NANO_TINY
|
||||
|
|
12
src/text.c
12
src/text.c
|
@ -296,12 +296,10 @@ void do_indent(void)
|
|||
char *indentation = charalloc(tabsize + 1);
|
||||
/* The whitespace added to each line in order to indent it. */
|
||||
filestruct *top, *bot, *line;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
/* Use either all the marked lines or just the current line. */
|
||||
if (openfile->mark)
|
||||
get_region((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x);
|
||||
get_region((const filestruct **)&top, (const filestruct **)&bot);
|
||||
else {
|
||||
top = openfile->current;
|
||||
bot = top;
|
||||
|
@ -401,12 +399,10 @@ void unindent_a_line(filestruct *line, size_t indent_len)
|
|||
void do_unindent(void)
|
||||
{
|
||||
filestruct *top, *bot, *line;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
/* Use either all the marked lines or just the current line. */
|
||||
if (openfile->mark)
|
||||
get_region((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x);
|
||||
get_region((const filestruct **)&top, (const filestruct **)&bot);
|
||||
else {
|
||||
top = openfile->current;
|
||||
bot = top;
|
||||
|
@ -494,7 +490,6 @@ void do_comment(void)
|
|||
const char *comment_seq = GENERAL_COMMENT_CHARACTER;
|
||||
undo_type action = UNCOMMENT;
|
||||
filestruct *top, *bot, *line;
|
||||
size_t top_x, bot_x;
|
||||
bool empty, all_empty = TRUE;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
@ -509,8 +504,7 @@ void do_comment(void)
|
|||
|
||||
/* Determine which lines to work on. */
|
||||
if (openfile->mark)
|
||||
get_region((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x);
|
||||
get_region((const filestruct **)&top, (const filestruct **)&bot);
|
||||
else {
|
||||
top = openfile->current;
|
||||
bot = top;
|
||||
|
|
|
@ -534,12 +534,13 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
|||
|
||||
/* Get the start and end points of the marked region, but
|
||||
* push the end point back if it's at the start of a line. */
|
||||
void get_region(const filestruct **top, size_t *top_x,
|
||||
const filestruct **bot, size_t *bot_x)
|
||||
void get_region(const filestruct **top, const filestruct **bot)
|
||||
{
|
||||
mark_order(top, top_x, bot, bot_x, NULL);
|
||||
size_t top_x, bot_x;
|
||||
|
||||
if (*bot_x == 0)
|
||||
mark_order(top, &top_x, bot, &bot_x, NULL);
|
||||
|
||||
if (bot_x == 0)
|
||||
*bot = (*bot)->prev;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue