nano: fix gcc2 build for 2.8.2.

This commit is contained in:
Jerome Duval
2017-05-13 22:14:49 +02:00
parent 83cee915f9
commit 952836abdf
2 changed files with 95 additions and 18 deletions

View File

@@ -17,7 +17,7 @@ SOURCE_URI="http://www.nano-editor.org/dist/v2.8/nano-$portVersion.tar.gz"
CHECKSUM_SHA256="0aa9cd6bd5b372ce9a196a9677af58c1826a9235a14daffe604100a9c259854b"
PATCHES="nano-$portVersion.patchset"
ARCHITECTURES="?x86_gcc2 x86 x86_64"
ARCHITECTURES="x86_gcc2 x86 x86_64"
PROVIDES="
nano = $portVersion compat >= 2

View File

@@ -1,14 +1,29 @@
From 3d727c927c05a2c4bdb2e23f86c4a90d9a9812b9 Mon Sep 17 00:00:00 2001
From ee92b9e1bec330fcf0cb7f080576054d76e0c61b Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 21 Dec 2016 22:21:56 +0000
Subject: gcc2 patch
diff --git a/lib/glob.c b/lib/glob.c
index 2986add..11adb74 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -189,8 +189,10 @@ convert_dirent (const struct dirent *source)
struct readdir_result result = { NULL, };
return result;
}
+ {
struct readdir_result result = READDIR_RESULT_INITIALIZER (source);
return result;
+ }
}
#ifndef COMPILE_GLOB64
diff --git a/src/files.c b/src/files.c
index 033b963..5838042 100644
index a90c249..535c38c 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1991,6 +1991,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
@@ -1987,6 +1987,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
if (method == OVERWRITE && !tmp) {
/* If we must set the filename, and it changed, adjust things. */
if (!nonamechange && strcmp(openfile->filename, realname) != 0) {
@@ -16,7 +31,7 @@ index 033b963..5838042 100644
#ifndef DISABLE_COLOR
char *oldname = openfile->syntax ? openfile->syntax->name : "";
filestruct *line = openfile->fileage;
@@ -2002,7 +2003,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
@@ -1998,7 +1999,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
color_update();
color_init();
@@ -25,11 +40,27 @@ index 033b963..5838042 100644
/* If the syntax changed, discard and recompute the multidata. */
if (strcmp(oldname, newname) != 0) {
@@ -2470,6 +2471,7 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
*num_matches = 0;
#ifdef HAVE_PWD_H
+ {
const struct passwd *userdata;
while ((userdata = getpwent()) != NULL) {
@@ -2492,6 +2494,7 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
}
}
endpwent();
+ }
#endif
return matches;
diff --git a/src/rcfile.c b/src/rcfile.c
index e751d86..0111121 100644
index c8bb4e0..8cdf0d6 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -879,6 +879,8 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
@@ -878,6 +878,8 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
/* Parse and store the name given after a linter/formatter command. */
void pick_up_name(const char *kind, char *ptr, char **storage)
{
@@ -38,7 +69,7 @@ index e751d86..0111121 100644
assert(ptr != NULL);
if (!opensyntax) {
@@ -899,8 +901,8 @@ void pick_up_name(const char *kind, char *ptr, char **storage)
@@ -898,8 +900,8 @@ void pick_up_name(const char *kind, char *ptr, char **storage)
*storage = NULL;
else if (*ptr == '"') {
*storage = mallocstrcpy(NULL, ++ptr);
@@ -50,10 +81,10 @@ index e751d86..0111121 100644
while (*p != '"') {
if (*p == '\0') {
diff --git a/src/text.c b/src/text.c
index fc92d11..8e5e5c0 100644
index 251a3e6..702b474 100644
--- a/src/text.c
+++ b/src/text.c
@@ -654,11 +654,13 @@ void undo_cut(undo *u)
@@ -653,11 +653,13 @@ void undo_cut(undo *u)
/* Redo a cut, or undo an uncut. */
void redo_cut(undo *u)
{
@@ -68,7 +99,7 @@ index fc92d11..8e5e5c0 100644
cutbuffer = cutbottom = NULL;
goto_line_posx(u->lineno, u->begin);
@@ -680,6 +682,7 @@ void do_undo(void)
@@ -679,6 +681,7 @@ void do_undo(void)
undo *u = openfile->current_undo;
filestruct *f, *t = NULL;
char *data, *undidmsg = NULL;
@@ -76,7 +107,23 @@ index fc92d11..8e5e5c0 100644
if (!u) {
statusbar(_("Nothing in undo buffer!"));
@@ -786,7 +789,7 @@ void do_undo(void)
@@ -767,6 +770,7 @@ void do_undo(void)
break;
}
undidmsg = _("line break");
+ {
size_t from_x = (u->begin == 0) ? 0 : u->mark_begin_x;
size_t to_x = (u->begin == 0) ? u->mark_begin_x : u->begin;
f->data = charealloc(f->data, strlen(f->data) +
@@ -774,6 +778,7 @@ void do_undo(void)
strcat(f->data, &u->strdata[from_x]);
unlink_node(f->next);
goto_line_posx(u->lineno, to_x);
+ }
break;
#ifdef ENABLE_COMMENT
case COMMENT:
@@ -787,7 +792,7 @@ void do_undo(void)
#endif
case INSERT:
undidmsg = _("text insert");
@@ -85,7 +132,7 @@ index fc92d11..8e5e5c0 100644
cutbuffer = NULL;
cutbottom = NULL;
openfile->mark_begin = fsfromline(u->mark_begin_lineno);
@@ -831,7 +834,7 @@ void do_undo(void)
@@ -832,7 +837,7 @@ void do_undo(void)
/* Redo the last thing(s) we undid. */
void do_redo(void)
{
@@ -94,7 +141,7 @@ index fc92d11..8e5e5c0 100644
char *data, *redidmsg = NULL;
undo *u = openfile->undotop;
@@ -882,7 +885,7 @@ void do_redo(void)
@@ -883,7 +888,7 @@ void do_redo(void)
break;
case ENTER:
redidmsg = _("line break");
@@ -103,7 +150,7 @@ index fc92d11..8e5e5c0 100644
shoveline->data = mallocstrcpy(NULL, u->strdata);
data = mallocstrncpy(NULL, f->data, u->begin + 1);
data[u->begin] = '\0';
@@ -1399,10 +1402,11 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
@@ -1405,10 +1410,11 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
if ((u->lineno == u->mark_begin_lineno && u->begin < u->mark_begin_x)
|| u->lineno < u->mark_begin_lineno) {
size_t x_loc = u->begin;
@@ -116,7 +163,7 @@ index fc92d11..8e5e5c0 100644
u->lineno = u->mark_begin_lineno;
u->mark_begin_lineno = line;
} else
@@ -1478,6 +1482,8 @@ bool do_wrap(filestruct *line)
@@ -1484,6 +1490,8 @@ bool do_wrap(filestruct *line)
/* The next line, minus indentation. */
size_t next_line_len = 0;
/* The length of next_line. */
@@ -125,7 +172,7 @@ index fc92d11..8e5e5c0 100644
/* There are three steps. First, we decide where to wrap. Then, we
* create the new wrap line. Finally, we clean up. */
@@ -1521,8 +1527,8 @@ bool do_wrap(filestruct *line)
@@ -1527,8 +1535,8 @@ bool do_wrap(filestruct *line)
add_undo(SPLIT_BEGIN);
#endif
@@ -136,6 +183,36 @@ index fc92d11..8e5e5c0 100644
openfile->current = line;
/* Step 2, making the new wrap line. It will consist of indentation
diff --git a/src/winio.c b/src/winio.c
index 4511322..8e17edb 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2382,7 +2382,10 @@ void edit_draw(filestruct *fileptr, const char *converted,
/* The place in converted from where painting starts. */
regmatch_t match;
/* The match positions of a single-line regex. */
-
+ const filestruct *start_line, *end_line;
+ /* The line that matches 'end'. */
+ regmatch_t startmatch, endmatch;
+
/* Two notes about regexec(). A return value of zero means
* that there is a match. Also, rm_eo is the first
* non-matching character after the match. */
@@ -2437,11 +2440,9 @@ void edit_draw(filestruct *fileptr, const char *converted,
}
/* Second case: varnish is a multiline expression. */
- const filestruct *start_line = fileptr->prev;
+ start_line = fileptr->prev;
/* The first line before fileptr that matches 'start'. */
- const filestruct *end_line = fileptr;
- /* The line that matches 'end'. */
- regmatch_t startmatch, endmatch;
+ end_line = fileptr;
/* The match positions of the start and end regexes. */
/* Assume nothing gets painted until proven otherwise below. */
--
2.11.0
2.7.0