Reduce the length of long lines

This commit is contained in:
Landon Curt Noll
2021-12-01 23:15:06 -08:00
parent f794b8d859
commit bb041098bc
4 changed files with 37 additions and 18 deletions

15
func.c
View File

@@ -161,11 +161,16 @@ STATIC HALF _nineval_[] = { 9 };
STATIC HALF _twentyfourval_[] = { 24 }; STATIC HALF _twentyfourval_[] = { 24 };
STATIC HALF _threesixtyval_[] = { 360 }; STATIC HALF _threesixtyval_[] = { 360 };
STATIC HALF _fourhundredval_[] = { 400 }; STATIC HALF _fourhundredval_[] = { 400 };
STATIC NUMBER _qtendivnine_ = { { _tenval_, 1, 0 }, { _nineval_, 1, 0 }, 1, NULL }; STATIC NUMBER _qtendivnine_ = { { _tenval_, 1, 0 },
STATIC NUMBER _qninedivten_ = { { _nineval_, 1, 0 }, { _tenval_, 1, 0 }, 1, NULL }; { _nineval_, 1, 0 }, 1, NULL };
STATIC NUMBER _qtwentyfour = { { _twentyfourval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL }; STATIC NUMBER _qninedivten_ = { { _nineval_, 1, 0 },
STATIC NUMBER _qthreesixty = { { _threesixtyval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL }; { _tenval_, 1, 0 }, 1, NULL };
STATIC NUMBER _qfourhundred = { { _fourhundredval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL }; STATIC NUMBER _qtwentyfour = { { _twentyfourval_, 1, 0 },
{ _oneval_, 1, 0 }, 1, NULL };
STATIC NUMBER _qthreesixty = { { _threesixtyval_, 1, 0 },
{ _oneval_, 1, 0 }, 1, NULL };
STATIC NUMBER _qfourhundred = { { _fourhundredval_, 1, 0 },
{ _oneval_, 1, 0 }, 1, NULL };
/* /*

27
str.c
View File

@@ -43,7 +43,7 @@
#define STR_TABLECHUNK 100 /* how often to reallocate string table */ #define STR_TABLECHUNK 100 /* how often to reallocate string table */
#define STR_CHUNK (1<<11) /* size of string storage allocation */ #define STR_CHUNK (1<<11) /* size of string storage allocation */
#define OCTET_VALUES 256 /* number of different values an OCTET can have */ #define OCTET_VALUES 256 /* number of different values in a OCTET */
#define STR_UNIQUE (1<<7) /* size of string to allocate separately */ #define STR_UNIQUE (1<<7) /* size of string to allocate separately */
STRING _nullstring_ = {"", 0, 1, NULL}; STRING _nullstring_ = {"", 0, 1, NULL};
@@ -285,8 +285,8 @@ addliteral(char *str)
count = literals.l_maxcount + STR_TABLECHUNK; count = literals.l_maxcount + STR_TABLECHUNK;
if (literals.l_maxcount) { if (literals.l_maxcount) {
/* alloc + 1 guard paranoia */ /* alloc + 1 guard paranoia */
table = (char **) realloc(literals.l_table, (count + 1) * table = (char **) realloc(literals.l_table,
sizeof(char *)); (count + 1) * sizeof(char *));
table[count] = NULL; /* guard paranoia */ table[count] = NULL; /* guard paranoia */
} else { } else {
/* alloc + 1 guard paranoia */ /* alloc + 1 guard paranoia */
@@ -1130,7 +1130,8 @@ stralloc(void)
math_error("Unable to allocate memory for stralloc"); math_error("Unable to allocate memory for stralloc");
/*NOTREACHED*/ /*NOTREACHED*/
} }
memset(freeStr+STRALLOC, 0, sizeof(STRING)); /* guard paranoia */ /* guard paranoia */
memset(freeStr+STRALLOC, 0, sizeof(STRING));
freeStr[STRALLOC - 1].s_next = NULL; freeStr[STRALLOC - 1].s_next = NULL;
freeStr[STRALLOC - 1].s_links = 0; freeStr[STRALLOC - 1].s_links = 0;
@@ -1153,12 +1154,14 @@ stralloc(void)
blockcount++; blockcount++;
if (firstStrs == NULL) { if (firstStrs == NULL) {
/* alloc + 1 guard paranoia */ /* alloc + 1 guard paranoia */
newfn = (STRING **) malloc((blockcount + 1) * sizeof(STRING *)); newfn = (STRING **)
malloc((blockcount + 1) * sizeof(STRING *));
newfn[blockcount] = NULL; /* guard paranoia */ newfn[blockcount] = NULL; /* guard paranoia */
} else { } else {
/* alloc + 1 guard paranoia */ /* alloc + 1 guard paranoia */
newfn = (STRING **) newfn = (STRING **)
realloc(firstStrs, (blockcount + 1) * sizeof(STRING *)); realloc(firstStrs,
(blockcount + 1) * sizeof(STRING *));
newfn[blockcount] = NULL; /* guard paranoia */ newfn[blockcount] = NULL; /* guard paranoia */
} }
if (newfn == NULL) { if (newfn == NULL) {
@@ -1299,7 +1302,8 @@ void
initstrings(void) initstrings(void)
{ {
/* alloc + 1 guard paranoia */ /* alloc + 1 guard paranoia */
stringconsttable = (STRING **) malloc(sizeof(STRING *) * (STRCONSTALLOC + 1)); stringconsttable = (STRING **)
malloc(sizeof(STRING *) * (STRCONSTALLOC + 1));
if (stringconsttable == NULL) { if (stringconsttable == NULL) {
math_error("Unable to allocate constant table"); math_error("Unable to allocate constant table");
/*NOTREACHED*/ /*NOTREACHED*/
@@ -1332,14 +1336,17 @@ addstring(char *str, size_t len)
initstrings(); initstrings();
} else { } else {
/* alloc + 1 guard paranoia */ /* alloc + 1 guard paranoia */
sp = (STRING **) realloc((char *) stringconsttable, sp = (STRING **)
sizeof(STRING *) * (stringconstcount + STRCONSTALLOC + 1)); realloc((char *) stringconsttable,
sizeof(STRING *) *
(stringconstcount + STRCONSTALLOC + 1));
if (sp == NULL) { if (sp == NULL) {
math_error("Unable to reallocate string " math_error("Unable to reallocate string "
"const table"); "const table");
/*NOTREACHED*/ /*NOTREACHED*/
} }
sp[stringconstcount + STRCONSTALLOC] = NULL; /* guard paranoia */ /* guard paranoia */
sp[stringconstcount + STRCONSTALLOC] = NULL;
stringconsttable = sp; stringconsttable = sp;
stringconstavail = STRCONSTALLOC; stringconstavail = STRCONSTALLOC;
} }

View File

@@ -110,7 +110,8 @@ addglobal(char *name, BOOL isstatic)
return NULL; return NULL;
hp = &globalhash[HASHSYM(name, len)]; hp = &globalhash[HASHSYM(name, len)];
for (sp = *hp; sp; sp = sp->g_next) { for (sp = *hp; sp; sp = sp->g_next) {
if ((sp->g_len == len) && (strncmp(sp->g_name, name, len+1) == 0) if ((sp->g_len == len) &&
(strncmp(sp->g_name, name, len+1) == 0)
&& (sp->g_filescope == newfilescope) && (sp->g_filescope == newfilescope)
&& (sp->g_funcscope == newfuncscope)) && (sp->g_funcscope == newfuncscope))
return sp; return sp;
@@ -146,7 +147,8 @@ findglobal(char *name)
bestsp = NULL; bestsp = NULL;
len = strlen(name); len = strlen(name);
for (sp = globalhash[HASHSYM(name, len)]; sp != NULL; sp = sp->g_next) { for (sp = globalhash[HASHSYM(name, len)]; sp != NULL; sp = sp->g_next) {
if ((sp->g_len == len) && (strncmp(sp->g_name, name, len+1) == 0)) { if ((sp->g_len == len) &&
(strncmp(sp->g_name, name, len+1) == 0)) {
if ((bestsp == NULL) || if ((bestsp == NULL) ||
(sp->g_filescope > bestsp->g_filescope) || (sp->g_filescope > bestsp->g_filescope) ||
(sp->g_funcscope > bestsp->g_funcscope)) (sp->g_funcscope > bestsp->g_funcscope))

View File

@@ -579,7 +579,12 @@ E_FUNC void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
#define zcopyval(z1,z2) memcpy((z2).v, (z1).v, (z1).len * sizeof(HALF)) #define zcopyval(z1,z2) memcpy((z2).v, (z1).v, (z1).len * sizeof(HALF))
#define zquicktrim(z) {if (((z).len > 1) && ((z).v[(z).len-1] == 0)) \ #define zquicktrim(z) {if (((z).len > 1) && ((z).v[(z).len-1] == 0)) \
(z).len--;} (z).len--;}
#define zfree(z) {if ((z).len != 0 && (z).v != NULL) { freeh((z).v); (z).v = NULL; (z).len = 0; (z).sign = 0; } } #define zfree(z) {if ((z).len != 0 && (z).v != NULL) { \
freeh((z).v); \
(z).v = NULL; \
(z).len = 0; \
(z).sign = 0; } \
}
/* /*