mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t9.4.4
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -224,6 +224,9 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
|
||||
|
||||
Unknown error 9999
|
||||
|
||||
Fixed some insure code inspection tool issues that were discovered
|
||||
and investigated by Michel van der List <vanderlistmj@sbphrd.com>.
|
||||
|
||||
|
||||
Following is the change from calc version 2.11.0t8 to 2.11.0t8.9:
|
||||
|
||||
|
15
qmath.c
15
qmath.c
@@ -1382,10 +1382,23 @@ qalloc(void)
|
||||
}
|
||||
freeNum[NNALLOC - 1].next = NULL;
|
||||
freeNum[NNALLOC - 1].links = 0;
|
||||
for (temp = freeNum + NNALLOC - 2; temp >= freeNum; --temp) {
|
||||
|
||||
/*
|
||||
* We prevent the temp pointer from walking behind freeNum
|
||||
* by stopping one short of the end and running the loop one
|
||||
* more time.
|
||||
*
|
||||
* We would stop the loop with just temp >= freeNum, but
|
||||
* doing this helps make code checkers such as insure happy.
|
||||
*/
|
||||
for (temp = freeNum + NNALLOC - 2; temp > freeNum; --temp) {
|
||||
temp->next = temp + 1;
|
||||
temp->links = 0;
|
||||
}
|
||||
/* run the loop manually one last time */
|
||||
temp->next = temp + 1;
|
||||
temp->links = 0;
|
||||
|
||||
blockcount++;
|
||||
if (firstNums == NULL) {
|
||||
newfn = (NUMBER **) malloc(blockcount * sizeof(NUMBER *));
|
||||
|
15
string.c
15
string.c
@@ -979,10 +979,23 @@ stralloc(void)
|
||||
}
|
||||
freeStr[STRALLOC - 1].s_next = NULL;
|
||||
freeStr[STRALLOC - 1].s_links = 0;
|
||||
for (temp = freeStr + STRALLOC - 2; temp >= freeStr; --temp) {
|
||||
|
||||
/*
|
||||
* We prevent the temp pointer from walking behind freeStr
|
||||
* by stopping one short of the end and running the loop one
|
||||
* more time.
|
||||
*
|
||||
* We would stop the loop with just temp >= freeStr, but
|
||||
* doing this helps make code checkers such as insure happy.
|
||||
*/
|
||||
for (temp = freeStr + STRALLOC - 2; temp > freeStr; --temp) {
|
||||
temp->s_next = temp + 1;
|
||||
temp->s_links = 0;
|
||||
}
|
||||
/* run the loop manually one last time */
|
||||
temp->s_next = temp + 1;
|
||||
temp->s_links = 0;
|
||||
|
||||
blockcount++;
|
||||
if (firstStrs == NULL) {
|
||||
newfn = (STRING **) malloc( blockcount * sizeof(STRING *));
|
||||
|
52
symbol.c
52
symbol.c
@@ -345,8 +345,17 @@ freeglobals(void)
|
||||
GLOBAL *sp; /* current global symbol pointer */
|
||||
long count; /* number of global variables freed */
|
||||
|
||||
/*
|
||||
* We prevent the hp pointer from walking behind globalhash
|
||||
* by stopping one short of the end and running the loop one
|
||||
* more time.
|
||||
*
|
||||
* We could stop the loop with just hp >= globalhash, but stopping
|
||||
* short and running the loop one last time manually helps make
|
||||
* code checkers such as insure happy.
|
||||
*/
|
||||
count = 0;
|
||||
for (hp = &globalhash[HASHSIZE-1]; hp >= globalhash; hp--) {
|
||||
for (hp = &globalhash[HASHSIZE-1]; hp > globalhash; hp--) {
|
||||
for (sp = *hp; sp; sp = sp->g_next) {
|
||||
if (sp->g_value.v_type != V_NULL) {
|
||||
freevalue(&sp->g_value);
|
||||
@@ -354,6 +363,13 @@ freeglobals(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* run the loop manually one last time */
|
||||
for (sp = *hp; sp; sp = sp->g_next) {
|
||||
if (sp->g_value.v_type != V_NULL) {
|
||||
freevalue(&sp->g_value);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -542,14 +558,22 @@ unscope(void)
|
||||
register GLOBAL *sp; /* current global symbol pointer */
|
||||
GLOBAL *prevsp; /* previous kept symbol pointer */
|
||||
|
||||
for (hp = &globalhash[HASHSIZE-1]; hp >= globalhash; hp--) {
|
||||
/*
|
||||
* We prevent the hp pointer from walking behind globalhash
|
||||
* by stopping one short of the end and running the loop one
|
||||
* more time.
|
||||
*
|
||||
* We could stop the loop with just hp >= globalhash, but stopping
|
||||
* short and running the loop one last time manually helps make
|
||||
* code checkers such as insure happy.
|
||||
*/
|
||||
for (hp = &globalhash[HASHSIZE-1]; hp > globalhash; hp--) {
|
||||
prevsp = NULL;
|
||||
for (sp = *hp; sp; sp = sp->g_next) {
|
||||
if ((sp->g_filescope == SCOPE_GLOBAL) ||
|
||||
(sp->g_filescope < filescope) ||
|
||||
((sp->g_filescope == filescope) &&
|
||||
(sp->g_funcscope <= funcscope)))
|
||||
{
|
||||
(sp->g_funcscope <= funcscope))) {
|
||||
prevsp = sp;
|
||||
continue;
|
||||
}
|
||||
@@ -564,6 +588,26 @@ unscope(void)
|
||||
*hp = sp->g_next;
|
||||
}
|
||||
}
|
||||
/* run the loop manually one last time */
|
||||
prevsp = NULL;
|
||||
for (sp = *hp; sp; sp = sp->g_next) {
|
||||
if ((sp->g_filescope == SCOPE_GLOBAL) ||
|
||||
(sp->g_filescope < filescope) ||
|
||||
((sp->g_filescope == filescope) &&
|
||||
(sp->g_funcscope <= funcscope))) {
|
||||
prevsp = sp;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* This symbol needs removing.
|
||||
*/
|
||||
addstatic(sp);
|
||||
if (prevsp)
|
||||
prevsp->g_next = sp->g_next;
|
||||
else
|
||||
*hp = sp->g_next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -18,7 +18,7 @@ static char *program;
|
||||
#define MAJOR_VER 2 /* major version */
|
||||
#define MINOR_VER 11 /* minor version */
|
||||
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH "9.4.3" /* test number or empty string if no patch */
|
||||
#define MINOR_PATCH "9.4.4" /* test number or empty string if no patch */
|
||||
|
||||
/*
|
||||
* calc version constants
|
||||
|
83
zfunc.c
83
zfunc.c
@@ -1109,7 +1109,17 @@ zlog(ZVALUE z1, ZVALUE z2)
|
||||
*/
|
||||
val = _one_;
|
||||
power = 0;
|
||||
for (; zp >= squares; zp--, worth /= 2) {
|
||||
|
||||
/*
|
||||
* We prevent the zp pointer from walking behind squares
|
||||
* by stopping one short of the end and running the loop one
|
||||
* more time.
|
||||
*
|
||||
* We could stop the loop with just zp >= squares, but stopping
|
||||
* short and running the loop one last time manually helps make
|
||||
* code checkers such as insure happy.
|
||||
*/
|
||||
for (; zp > squares; zp--, worth /= 2) {
|
||||
if ((val.len + zp->len - 1) <= z1.len) {
|
||||
zmul(val, *zp, &temp);
|
||||
if (zrel(z1, temp) >= 0) {
|
||||
@@ -1123,6 +1133,22 @@ zlog(ZVALUE z1, ZVALUE z2)
|
||||
if (zp != squares)
|
||||
zfree(*zp);
|
||||
}
|
||||
/* run the loop manually one last time */
|
||||
if (zp == squares) {
|
||||
if ((val.len + zp->len - 1) <= z1.len) {
|
||||
zmul(val, *zp, &temp);
|
||||
if (zrel(z1, temp) >= 0) {
|
||||
zfree(val);
|
||||
val = temp;
|
||||
power += worth;
|
||||
} else {
|
||||
zfree(temp);
|
||||
}
|
||||
}
|
||||
if (zp != squares)
|
||||
zfree(*zp);
|
||||
}
|
||||
|
||||
zfree(val);
|
||||
return power;
|
||||
}
|
||||
@@ -1163,7 +1189,17 @@ zlog10(ZVALUE z)
|
||||
*/
|
||||
val = _one_;
|
||||
power = 0;
|
||||
for (; zp >= _tenpowers_; zp--, worth /= 2) {
|
||||
|
||||
/*
|
||||
* We prevent the zp pointer from walking behind _tenpowers_
|
||||
* by stopping one short of the end and running the loop one
|
||||
* more time.
|
||||
*
|
||||
* We could stop the loop with just zp >= _tenpowers_, but stopping
|
||||
* short and running the loop one last time manually helps make
|
||||
* code checkers such as insure happy.
|
||||
*/
|
||||
for (; zp > _tenpowers_; zp--, worth /= 2) {
|
||||
if ((val.len + zp->len - 1) <= z.len) {
|
||||
zmul(val, *zp, &temp);
|
||||
if (zrel(z, temp) >= 0) {
|
||||
@@ -1175,6 +1211,20 @@ zlog10(ZVALUE z)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* run the loop manually one last time */
|
||||
if (zp == _tenpowers_) {
|
||||
if ((val.len + zp->len - 1) <= z.len) {
|
||||
zmul(val, *zp, &temp);
|
||||
if (zrel(z, temp) >= 0) {
|
||||
zfree(val);
|
||||
val = temp;
|
||||
power += worth;
|
||||
} else {
|
||||
zfree(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zfree(val);
|
||||
return power;
|
||||
}
|
||||
@@ -1281,11 +1331,21 @@ zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem)
|
||||
worth *= 2;
|
||||
count += worth;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now back down the list of squares, and see if the lower powers
|
||||
* will divide any more times.
|
||||
*/
|
||||
for (; zp >= squares; zp--, worth /= 2) {
|
||||
/*
|
||||
* We prevent the zp pointer from walking behind squares
|
||||
* by stopping one short of the end and running the loop one
|
||||
* more time.
|
||||
*
|
||||
* We could stop the loop with just zp >= squares, but stopping
|
||||
* short and running the loop one last time manually helps make
|
||||
* code checkers such as insure happy.
|
||||
*/
|
||||
for (; zp > squares; zp--, worth /= 2) {
|
||||
if (zp->len <= z1.len) {
|
||||
zdiv(z1, *zp, &temp1, &temp2, 0);
|
||||
if (ziszero(temp2)) {
|
||||
@@ -1300,6 +1360,23 @@ zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem)
|
||||
if (zp != squares)
|
||||
zfree(*zp);
|
||||
}
|
||||
/* run the loop manually one last time */
|
||||
if (zp == squares) {
|
||||
if (zp->len <= z1.len) {
|
||||
zdiv(z1, *zp, &temp1, &temp2, 0);
|
||||
if (ziszero(temp2)) {
|
||||
temp3 = z1;
|
||||
z1 = temp1;
|
||||
temp1 = temp3;
|
||||
count += worth;
|
||||
}
|
||||
zfree(temp1);
|
||||
zfree(temp2);
|
||||
}
|
||||
if (zp != squares)
|
||||
zfree(*zp);
|
||||
}
|
||||
|
||||
*rem = z1;
|
||||
return count;
|
||||
}
|
||||
|
Reference in New Issue
Block a user