conform usage of alloca function
This commit is contained in:
parent
76bec88bc0
commit
cbde69e90a
@ -24,10 +24,6 @@
|
|||||||
// Arealist functions.
|
// Arealist functions.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
/* C4786: 'identifier' : identifier was truncated to 'number'
|
/* C4786: 'identifier' : identifier was truncated to 'number'
|
||||||
characters in the debug information
|
characters in the debug information
|
||||||
@ -37,6 +33,10 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ void SelMaskPick::close() {
|
|||||||
|
|
||||||
void SelMaskPick::print_line(uint idx, uint pos, bool isbar) {
|
void SelMaskPick::print_line(uint idx, uint pos, bool isbar) {
|
||||||
|
|
||||||
#if defined(__WIN32__)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *buf = (char*)alloca(DESC_LEN+3);
|
char *buf = (char*)alloca(DESC_LEN+3);
|
||||||
#else
|
#else
|
||||||
__extension__ char buf[DESC_LEN+3];
|
__extension__ char buf[DESC_LEN+3];
|
||||||
|
@ -24,15 +24,15 @@
|
|||||||
// The Internal Editor (IE), part 2.
|
// The Internal Editor (IE), part 2.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
#include <geedit.h>
|
#include <geedit.h>
|
||||||
#include <gutlcode.h>
|
#include <gutlcode.h>
|
||||||
#include <gutlclip.h>
|
#include <gutlclip.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
@ -1090,7 +1090,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
|
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *spaces = (char*)alloca(tabsz+1);
|
char *spaces = (char*)alloca(tabsz+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char spaces[tabsz+1];
|
__extension__ char spaces[tabsz+1];
|
||||||
|
@ -24,14 +24,15 @@
|
|||||||
// OS/2 clipboard to/from edit paste buffer.
|
// OS/2 clipboard to/from edit paste buffer.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
#include <geedit.h>
|
#include <geedit.h>
|
||||||
#include <gutlclip.h>
|
#include <gutlclip.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void IEclass::Clip2Buf() {
|
void IEclass::Clip2Buf() {
|
||||||
|
|
||||||
gclipbrd clipbrd;
|
gclipbrd clipbrd;
|
||||||
@ -40,7 +41,7 @@ void IEclass::Clip2Buf() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
|
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *spaces = (char*)alloca(tabsz+1);
|
char *spaces = (char*)alloca(tabsz+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char spaces[tabsz+1];
|
__extension__ char spaces[tabsz+1];
|
||||||
|
@ -24,15 +24,15 @@
|
|||||||
// File handling.
|
// File handling.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
#include <gwildmat.h>
|
#include <gwildmat.h>
|
||||||
#include <gdirposx.h>
|
#include <gdirposx.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
@ -777,7 +777,7 @@ void FileRequest(GMsg* msg) {
|
|||||||
else
|
else
|
||||||
ptr1 = ptr2;
|
ptr1 = ptr2;
|
||||||
ptr2 = strskip_txt(ptr1);
|
ptr2 = strskip_txt(ptr1);
|
||||||
#if defined(_MSC_VER)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *tmpbuf = (char*)alloca(ptr2-ptr1+1);
|
char *tmpbuf = (char*)alloca(ptr2-ptr1+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char tmpbuf[ptr2-ptr1+1];
|
__extension__ char tmpbuf[ptr2-ptr1+1];
|
||||||
@ -819,7 +819,7 @@ void FileRequest(GMsg* msg) {
|
|||||||
if(txtptr[16] == '/' and txtptr[19] == '/' and txtptr[24] == '(' /*)*/) {
|
if(txtptr[16] == '/' and txtptr[19] == '/' and txtptr[24] == '(' /*)*/) {
|
||||||
ptr1 = strskip_wht(txtptr);
|
ptr1 = strskip_wht(txtptr);
|
||||||
ptr2 = strskip_txt(ptr1);
|
ptr2 = strskip_txt(ptr1);
|
||||||
#if defined(_MSC_VER)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *tmpbuf = (char*)alloca(ptr2-ptr1+1);
|
char *tmpbuf = (char*)alloca(ptr2-ptr1+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char tmpbuf[ptr2-ptr1+1];
|
__extension__ char tmpbuf[ptr2-ptr1+1];
|
||||||
@ -955,7 +955,7 @@ void FileRequest(GMsg* msg) {
|
|||||||
msg->attr.frq1();
|
msg->attr.frq1();
|
||||||
ptr = freqfile[n]+1; // 01234567890123456
|
ptr = freqfile[n]+1; // 01234567890123456
|
||||||
ptr2 = strskip_txt(ptr);
|
ptr2 = strskip_txt(ptr);
|
||||||
#if defined(_MSC_VER)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *tmpbuf = (char*)alloca(ptr2-ptr+1);
|
char *tmpbuf = (char*)alloca(ptr2-ptr+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char tmpbuf[ptr2-ptr+1];
|
__extension__ char tmpbuf[ptr2-ptr+1];
|
||||||
@ -978,7 +978,7 @@ void FileRequest(GMsg* msg) {
|
|||||||
msg->attr.frq1();
|
msg->attr.frq1();
|
||||||
ptr = freqfile[crsr]+1; // 01234567890123456
|
ptr = freqfile[crsr]+1; // 01234567890123456
|
||||||
ptr2 = strskip_txt(ptr);
|
ptr2 = strskip_txt(ptr);
|
||||||
#if defined(_MSC_VER)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *tmpbuf = (char*)alloca(ptr2-ptr+1);
|
char *tmpbuf = (char*)alloca(ptr2-ptr+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char tmpbuf[ptr2-ptr+1];
|
__extension__ char tmpbuf[ptr2-ptr+1];
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
// Header edit.
|
// Header edit.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
#include <gwinput.h>
|
#include <gwinput.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ bool GMsgHeaderEdit::validate() {
|
|||||||
bool res = set_to_address(msg, &toname, &toaddr, &fromaddr, &subj, 0, LNG->SelectDestNode, lookup);
|
bool res = set_to_address(msg, &toname, &toaddr, &fromaddr, &subj, 0, LNG->SelectDestNode, lookup);
|
||||||
|
|
||||||
vcurshow();
|
vcurshow();
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(__USE_ALLOCA__)
|
||||||
size_t bot2size = EDIT->HdrNodeLen()+1;
|
size_t bot2size = EDIT->HdrNodeLen()+1;
|
||||||
char *bot2 = (char*)alloca(bot2size);
|
char *bot2 = (char*)alloca(bot2size);
|
||||||
MakeAttrStr(bot2, bot2size, &msg->attr);
|
MakeAttrStr(bot2, bot2size, &msg->attr);
|
||||||
|
@ -24,16 +24,17 @@
|
|||||||
// Conversion of a raw message to a linked list of lines.
|
// Conversion of a raw message to a linked list of lines.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
#include <gstrmail.h>
|
#include <gstrmail.h>
|
||||||
#include <gutlcode.h>
|
#include <gutlcode.h>
|
||||||
#include <ghdrmime.h>
|
#include <ghdrmime.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
@ -1391,7 +1392,7 @@ int ScanLine(GMsg* msg, Line* line, const char* ptr, int getvalue, int mask) {
|
|||||||
ptr++;
|
ptr++;
|
||||||
char endchar = *ptr;
|
char endchar = *ptr;
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *kludge = (char*)alloca(ptr-kludge1+1);
|
char *kludge = (char*)alloca(ptr-kludge1+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char kludge[ptr-kludge1+1];
|
__extension__ char kludge[ptr-kludge1+1];
|
||||||
|
@ -24,15 +24,16 @@
|
|||||||
// Message lister.
|
// Message lister.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
#include <gcharset.h>
|
#include <gcharset.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
extern GMsg* reader_msg;
|
extern GMsg* reader_msg;
|
||||||
@ -841,7 +842,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) {
|
|||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
ulong maxlev = (100*window.width()+h_offset+1)/2;
|
ulong maxlev = (100*window.width()+h_offset+1)/2;
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *buf2 = (char*)alloca(maxlev*2+2);
|
char *buf2 = (char*)alloca(maxlev*2+2);
|
||||||
#else
|
#else
|
||||||
__extension__ char buf2[maxlev*2+2];
|
__extension__ char buf2[maxlev*2+2];
|
||||||
|
@ -24,14 +24,15 @@
|
|||||||
// Misc. msg handling.
|
// Misc. msg handling.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
#include <gtimall.h>
|
#include <gtimall.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
static bool tokenxchg(char*& dst, char* tok, const char* src, int len = 0, int cnt = 0, ...) {
|
static bool tokenxchg(char*& dst, char* tok, const char* src, int len = 0, int cnt = 0, ...) {
|
||||||
@ -488,7 +489,7 @@ void LoadText(GMsg* msg, const char* textfile) {
|
|||||||
buf = (char*)throw_malloc(PBUFSIZE);
|
buf = (char*)throw_malloc(PBUFSIZE);
|
||||||
|
|
||||||
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
|
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *spaces = (char*)alloca(tabsz+1);
|
char *spaces = (char*)alloca(tabsz+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char spaces[tabsz+1];
|
__extension__ char spaces[tabsz+1];
|
||||||
|
@ -24,10 +24,6 @@
|
|||||||
// Template handling.
|
// Template handling.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
/* C4786: 'identifier' : identifier was truncated to 'number'
|
/* C4786: 'identifier' : identifier was truncated to 'number'
|
||||||
characters in the debug information
|
characters in the debug information
|
||||||
@ -37,6 +33,10 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <golded.h>
|
#include <golded.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
|
|||||||
uint ctrlinfo;
|
uint ctrlinfo;
|
||||||
char textfile[GMAXPATH];
|
char textfile[GMAXPATH];
|
||||||
char indexfile[GMAXPATH];
|
char indexfile[GMAXPATH];
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
#if defined(__USE_ALLOCA__)
|
||||||
size_t sizeofbuf = CFG->quotemargin + 256;
|
size_t sizeofbuf = CFG->quotemargin + 256;
|
||||||
char *buf = (char*)alloca(sizeofbuf);
|
char *buf = (char*)alloca(sizeofbuf);
|
||||||
#else
|
#else
|
||||||
|
@ -24,12 +24,13 @@
|
|||||||
// Message viewer class implementation.
|
// Message viewer class implementation.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#include <golded.h>
|
||||||
|
#include <gutlos.h>
|
||||||
|
|
||||||
|
#if defined(__USE_ALLOCA__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <golded.h>
|
|
||||||
#include <gutlos.h>
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ void GMsgHeaderView::Paint() {
|
|||||||
else
|
else
|
||||||
*buf1 = NUL;
|
*buf1 = NUL;
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(__USE_ALLOCA__)
|
||||||
char *top = (char*)alloca(width+1);
|
char *top = (char*)alloca(width+1);
|
||||||
#else
|
#else
|
||||||
__extension__ char top[width+1];
|
__extension__ char top[width+1];
|
||||||
|
@ -110,6 +110,9 @@
|
|||||||
#define __HAVE_DRIVES__
|
#define __HAVE_DRIVES__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
|
#define __USE_ALLOCA__
|
||||||
|
#endif
|
||||||
|
|
||||||
/* --------------------------------------------------------------- */
|
/* --------------------------------------------------------------- */
|
||||||
/* System-wide constants */
|
/* System-wide constants */
|
||||||
|
@ -26,8 +26,9 @@
|
|||||||
|
|
||||||
#include <gstrall.h>
|
#include <gstrall.h>
|
||||||
#include <gwildmat.h>
|
#include <gwildmat.h>
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include <malloc.h>
|
#if defined(__USE_ALLOCA__)
|
||||||
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -45,9 +46,9 @@
|
|||||||
**
|
**
|
||||||
** Special thanks to Lars Mathiesen <thorinn@diku.dk> for the ABORT code.
|
** Special thanks to Lars Mathiesen <thorinn@diku.dk> for the ABORT code.
|
||||||
** This can greatly speed up failing wildcard patterns. For example:
|
** This can greatly speed up failing wildcard patterns. For example:
|
||||||
** pattern: -*-*-*-*-*-*-12-*-*-*-m-*-*-*
|
** pattern: -*-*-*-*-*-*-12-*-*-*-m-*-*-*
|
||||||
** text 1: -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1
|
** text 1: -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1
|
||||||
** text 2: -adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1
|
** text 2: -adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1
|
||||||
** Text 1 matches with 51 calls, while text 2 fails with 54 calls. Without
|
** Text 1 matches with 51 calls, while text 2 fails with 54 calls. Without
|
||||||
** the ABORT code, it takes 22310 calls to fail. Ugh. The following
|
** the ABORT code, it takes 22310 calls to fail. Ugh. The following
|
||||||
** explanation is from Lars:
|
** explanation is from Lars:
|
||||||
@ -167,7 +168,7 @@ bool strwild(const char* str, const char* wild) {
|
|||||||
if(wild[1] == NUL)
|
if(wild[1] == NUL)
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
#ifdef _MSC_VER
|
#if defined(__USE_ALLOCA__)
|
||||||
char *buf = (char *)alloca(strlen(wild));
|
char *buf = (char *)alloca(strlen(wild));
|
||||||
#else
|
#else
|
||||||
__extension__ char buf[strlen(wild)];
|
__extension__ char buf[strlen(wild)];
|
||||||
|
Reference in New Issue
Block a user