Use aligned large buffers

This commit is contained in:
Arun Prakash Jana 2017-12-30 13:54:49 +05:30
parent 29188ca131
commit da7e30cd6f
No known key found for this signature in database
GPG key ID: A75979F35C080412

21
nnn.c
View file

@ -274,7 +274,7 @@ static const char *STR_INPUT = "No traversal delimiter allowed";
static const char *STR_INVBM = "Invalid bookmark"; static const char *STR_INVBM = "Invalid bookmark";
/* For use in functions which are isolated and don't return the buffer */ /* For use in functions which are isolated and don't return the buffer */
static char g_buf[MAX_CMD_LEN]; static char g_buf[MAX_CMD_LEN] __attribute__ ((aligned));
/* Forward declarations */ /* Forward declarations */
static void redraw(char *path); static void redraw(char *path);
@ -926,8 +926,8 @@ matches(char *fltr)
static int static int
filterentries(char *path) filterentries(char *path)
{ {
static char ln[REGEX_MAX]; static char ln[REGEX_MAX] __attribute__ ((aligned));
static wchar_t wln[REGEX_MAX]; static wchar_t wln[REGEX_MAX] __attribute__ ((aligned));
static wint_t ch[2] = {0}; static wint_t ch[2] = {0};
int r, total = ndents, oldcur = cur, len = 1; int r, total = ndents, oldcur = cur, len = 1;
char *pln = ln + 1; char *pln = ln + 1;
@ -1233,7 +1233,7 @@ resetdircolor(mode_t mode)
static char * static char *
unescape(const char *str, uint maxcols) unescape(const char *str, uint maxcols)
{ {
static wchar_t wbuf[PATH_MAX]; static wchar_t wbuf[PATH_MAX] __attribute__ ((aligned));
static char *buffer; static char *buffer;
static wchar_t *buf; static wchar_t *buf;
static size_t len; static size_t len;
@ -2017,7 +2017,7 @@ populate(char *path, char *oldname, char *fltr)
static void static void
redraw(char *path) redraw(char *path)
{ {
static char buf[(NAME_MAX + 1) << 1]; static char buf[(NAME_MAX + 1) << 1] __attribute__ ((aligned));
static size_t ncols; static size_t ncols;
static int nlines, i; static int nlines, i;
static bool mode_changed; static bool mode_changed;
@ -2145,9 +2145,12 @@ redraw(char *path)
static void static void
browse(char *ipath, char *ifilter) browse(char *ipath, char *ifilter)
{ {
static char path[PATH_MAX], newpath[PATH_MAX], lastdir[PATH_MAX], mark[PATH_MAX]; static char path[PATH_MAX] __attribute__ ((aligned));
static char fltr[NAME_MAX + 1]; static char newpath[PATH_MAX] __attribute__ ((aligned));
static char oldname[NAME_MAX + 1]; static char lastdir[PATH_MAX] __attribute__ ((aligned));
static char mark[PATH_MAX] __attribute__ ((aligned));
static char fltr[NAME_MAX + 1] __attribute__ ((aligned));
static char oldname[NAME_MAX + 1] __attribute__ ((aligned));
char *dir, *tmp, *run = NULL, *env = NULL; char *dir, *tmp, *run = NULL, *env = NULL;
struct stat sb; struct stat sb;
int r, fd, presel; int r, fd, presel;
@ -2878,7 +2881,7 @@ Version: %s\n%s\n", VERSION, GENERAL_INFO);
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
static char cwd[PATH_MAX]; static char cwd[PATH_MAX] __attribute__ ((aligned));
char *ipath = NULL, *ifilter, *bmstr; char *ipath = NULL, *ifilter, *bmstr;
int opt; int opt;