try to prevent a segfault on macOS
This commit is contained in:
@@ -137,6 +137,12 @@ static FILE *vms_fopen(name, mode) const char *name, *mode;
|
|||||||
#define TAB '\t'
|
#define TAB '\t'
|
||||||
#define SPACE ' '
|
#define SPACE ' '
|
||||||
|
|
||||||
|
#ifdef MACOS
|
||||||
|
#define ALIGN32 __attribute__((aligned(32)))
|
||||||
|
#else
|
||||||
|
#define ALIGN32
|
||||||
|
#endif
|
||||||
|
|
||||||
struct tagstruct *first;
|
struct tagstruct *first;
|
||||||
struct tagstruct zerotag = { 0 };
|
struct tagstruct zerotag = { 0 };
|
||||||
|
|
||||||
@@ -339,14 +345,20 @@ RESTORE_WARNINGS
|
|||||||
|
|
||||||
static void doline(char *aline)
|
static void doline(char *aline)
|
||||||
{
|
{
|
||||||
char buf[255];
|
char buf[255], *cp;
|
||||||
struct tagstruct *tmptag;
|
struct tagstruct * ALIGN32 tmptag;
|
||||||
|
size_t slen;
|
||||||
|
|
||||||
if (!aline || (aline && *aline == '!')) {
|
if (!aline || (aline && *aline == '!')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmptag = malloc(sizeof(struct tagstruct));
|
cp = deeol(aline);
|
||||||
|
slen = strlen(cp);
|
||||||
|
if (slen > sizeof buf - 1) {
|
||||||
|
slen = sizeof buf - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmptag = malloc(sizeof *tmptag);
|
||||||
if (!tmptag) {
|
if (!tmptag) {
|
||||||
out_of_memory();
|
out_of_memory();
|
||||||
}
|
}
|
||||||
@@ -354,13 +366,14 @@ static void doline(char *aline)
|
|||||||
*tmptag = zerotag;
|
*tmptag = zerotag;
|
||||||
tmptag->marker = 0xDEADBEEF;
|
tmptag->marker = 0xDEADBEEF;
|
||||||
|
|
||||||
strncpy(buf, deeol(aline), sizeof buf - 1);
|
strncpy(buf, cp, slen);
|
||||||
|
buf[sizeof buf - 1] = '\0';
|
||||||
taglineparse(buf, tmptag);
|
taglineparse(buf, tmptag);
|
||||||
chain(tmptag);
|
chain(tmptag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tagstruct *prevtag = (struct tagstruct *) 0;
|
static struct tagstruct * ALIGN32 prevtag = NULL;
|
||||||
|
|
||||||
static void chain(struct tagstruct *tag)
|
static void chain(struct tagstruct *tag)
|
||||||
{
|
{
|
||||||
@@ -707,11 +720,13 @@ findtype(char *st, char *tag)
|
|||||||
|
|
||||||
if (!st) return (char *)0;
|
if (!st) return (char *)0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (st && strstr(st, "mapseen")) {
|
if (st && strstr(st, "mapseen")) {
|
||||||
int xx = 0;
|
int xx = 0;
|
||||||
|
|
||||||
xx++;
|
xx++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (st[0] == '/' && st[1] == '^') {
|
if (st[0] == '/' && st[1] == '^') {
|
||||||
tmp2 = tmp3 = tmp4 = (char *)0;
|
tmp2 = tmp3 = tmp4 = (char *)0;
|
||||||
tmp1 = &st[3];
|
tmp1 = &st[3];
|
||||||
|
|||||||
Reference in New Issue
Block a user